切换导航条
此项目
正在载入...
登录
韩昌
/
kaoshi3-fangweishangcheng
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
韩昌
2022-12-06 16:35:08 +0800
提交
9bd5b01bce2e54923c483cfd85c22855d5343cfd
1 个父辈
51d3be86
优化:上传图片多选
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
150 行增加
和
32 行删除
pages/index/addItem.vue
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/addItem.js.map
unpackage/dist/dev/mp-weixin/pages/index/addItem.js
pages/index/addItem.vue
查看文件 @
9bd5b01
...
...
@@ -89,16 +89,18 @@ export default {
console.log('当前位置的经度:' + res.longitude)
console.log('当前位置的纬度:' + res.latitude)
uni.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=${'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'}`,
data: {},
success: (res2) => {
console.log(res2, '腾讯地图打印');
}
})
url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${
res.longitude
}&key=${'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'}`,
data: {},
success: res2 => {
console.log(res2, '腾讯地图打印')
},
})
},
fail(err){
fail(err)
{
console.log(err)
}
}
,
})
},
// 切换图片 视频
...
...
@@ -169,7 +171,7 @@ export default {
mask: true,
title: '上传中...',
})
let
uploadFile = ''
var
uploadFile = ''
// 1.选择要上传的视频
const res = await uni.chooseMedia({
maxDuration: 60,
...
...
@@ -179,20 +181,55 @@ export default {
})
// console.log(res[1].tempFiles[0], 'url')
// 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath
console.log(res)
this.status == 'video' && (this.videoUrl = res[1].tempFiles[0].tempFilePath)
uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles
[0].tempFilePath
uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles
.map(it => it.tempFilePath)
var that = this
const arr = await uni.uploadFile({
// 需要上传的地址
url: that.vue_uploadAction,
// filePath 需要上传的文件
filePath: uploadFile,
name: 'file',
header: {
token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token
},
console.log(uploadFile)
if (this.status == 'video') {
var arr = await uni.uploadFile({
// 需要上传的地址
url: that.vue_uploadAction,
// filePath 需要上传的文件
filePath: uploadFile,
name: 'file',
header: {
token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token
},
})
let data = JSON.parse(arr[1].data)
console.log('data:', data)
if (data.code !== 1) {
// 视频上传失败了
uni.hideLoading()
uni.showToast({
title: data.msg,
icon: 'none',
})
return
}
// 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)
this.viList.push({
image: data.data.fullurl,
type: this.status == 'video' ? 'v' : 'i',
})
let data = JSON.parse(arr[1].data)
this.viList.length >1 && this.viList.splice(1,10)
uni.hideLoading()
}
if(this.status == 'image'){
for (let i = 0; i < uploadFile.length; i++) {
var arr = await uni.uploadFile({
// 需要上传的地址
url: that.vue_uploadAction,
// filePath 需要上传的文件
filePath: uploadFile[i],
name: 'file',
header: {
token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token
},
})
let data = JSON.parse(arr[1].data)
console.log('data:', data)
if (data.code !== 1) {
// 视频上传失败了
...
...
@@ -208,7 +245,28 @@ export default {
image: data.data.fullurl,
type: this.status == 'video' ? 'v' : 'i',
})
this.viList.length >9 && this.viList.splice(9,10)
uni.hideLoading()
}
}
// let data = JSON.parse(arr[1].data)
// console.log('data:', data)
// if (data.code !== 1) {
// // 视频上传失败了
// uni.hideLoading()
// uni.showToast({
// title: data.msg,
// icon: 'none',
// })
// return
// }
// // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)
// this.viList.push({
// image: data.data.fullurl,
// type: this.status == 'video' ? 'v' : 'i',
// })
// uni.hideLoading()
} catch (error) {
// console.log(error)
uni.hideLoading()
...
...
@@ -265,6 +323,7 @@ export default {
file: VIList, // string 否 文件json例如:{"video":"http://sdsads","imgList":["","",""]}
})
uni.showToast({ title: '发布成功' })
uni.navigateBack({ delta: 1 })
console.log(res, 'fabufabu')
} catch (error) {
console.log(error)
...
...
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/addItem.js.map
查看文件 @
9bd5b01
{
"version"
:
3
,
"sources"
:[
"uni-app:///main.js"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?f421"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?0a0e"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?dbe1"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?d3fd"
,
"uni-app:///pages/index/addItem.vue"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?8d90"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?adf3"
],
"names"
:[
"wx"
,
"__webpack_require_UNI_MP_PLUGIN__"
,
"__webpack_require__"
,
"createPage"
,
"Page"
],
"mappings"
:
"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"
,
"file"
:
"pages/index/addItem.js"
,
"sourcesContent"
:[
"import 'uni-pages';wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/index/addItem.vue'\ncreatePage(Page)"
,
"import { render, staticRenderFns, recyclableRender, components } from \"./addItem.vue?vue&type=template&id=6465dbee&\"\nvar renderjs\nimport script from \"./addItem.vue?vue&type=script&lang=js&\"\nexport * from \"./addItem.vue?vue&type=script&lang=js&\"\nimport style0 from \"./addItem.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"pages/index/addItem.vue\"\nexport default component.exports"
,
"export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=template&id=6465dbee&\""
,
"var components\ntry {\n components = {\n uNavbar: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-navbar/u-navbar\" */ \"uview-ui/components/u-navbar/u-navbar.vue\"\n )\n },\n uDivider: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-divider/u-divider\" */ \"uview-ui/components/u-divider/u-divider.vue\"\n )\n },\n \"u-Input\": function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u--input/u--input\" */ \"uview-ui/components/u--input/u--input.vue\"\n )\n },\n \"u-Textarea\": function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u--textarea/u--textarea\" */ \"uview-ui/components/u--textarea/u--textarea.vue\"\n )\n },\n uIcon: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-icon/u-icon\" */ \"uview-ui/components/u-icon/u-icon.vue\"\n )\n }\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }"
,
"import mod from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=script&lang=js&\""
,
"<template>\r\n <view>\r\n <u-navbar title=\"话题详情\" :autoBack=\"true\" placeholder></u-navbar>\r\n <u-divider></u-divider>\r\n <view class=\"mainBox\">\r\n <u--input placeholder=\"请输入标题\" border=\"bottom\" v-model=\"titleValue\" clearable></u--input>\r\n </view>\r\n\r\n <!-- 选择格式发布 -->\r\n <view class=\"mainBox\">\r\n <view class=\"stateBox flexA\">\r\n <view class=\"item flexC\" :class=\"[isImg && 'Z']\" @click=\"toggeleHandler(0)\">图片</view>\r\n <view class=\"item flexC\" :class=\"[!isImg && 'Z']\" @click=\"toggeleHandler(1)\">视频</view>\r\n </view>\r\n\r\n <u--textarea v-model=\"value1\" placeholder=\"请输入内容\"></u--textarea>\r\n\r\n <!-- 上传 -->\r\n <view class=\"uploadImage flexA\">\r\n <view v-for=\"(item, index) in viList\" class=\"aa\" :key=\"index\">\r\n <view class=\"del\" @click=\"delHandler(index)\">×</view>\r\n <image v-if=\"item.type === 'v'\" class=\"typeBox\" src=\"/static/player.png\" mode=\"scaleToFill\" />\r\n <!-- <view >视频格式</view> -->\r\n <image class=\"sty\" :src=\"item.image\" @click=\"previewImageHandler(item.type)\" mode=\"scaleToFill\" />\r\n </view>\r\n <view\r\n @click=\"chooseVideoHandler('video')\"\r\n class=\"flexC btnBox\"\r\n v-if=\"(status == 'video' && !viList.length) || (status == 'image' && viList.length < 9)\"\r\n >\r\n <u-icon name=\"camera-fill\"></u-icon>\r\n </view>\r\n </view>\r\n <u-divider></u-divider>\r\n\r\n <!-- 分类 -->\r\n <view class=\"cateBox flexA\">\r\n <view class=\"cateText\">话题分类:</view>\r\n <view\r\n v-for=\"(item, index) in cateList\"\r\n class=\"typeBox1 flexC\"\r\n @click=\"toggleTypeHandler(item.id, index)\"\r\n :class=\"[curType == index && 'ZZ']\"\r\n >\r\n {{ item.type_name }}\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <view class=\"bottomBtn\">\r\n <view class=\"flexC\" @click=\"getAddItem\">发表</view>\r\n </view>\r\n <view class=\"whiteBox\"></view>\r\n <view style=\"height: 130rpx\"></view>\r\n </view>\r\n</template>\r\n\r\n<script>\r\nimport { getAddItem, getTabsCate } from '@/api'\r\nexport default {\r\n data() {\r\n return {\r\n isImg: true,\r\n // 标题\r\n titleValue: '',\r\n // 内容\r\n value1: '',\r\n status: 'image',\r\n viList: [],\r\n vue_uploadAction: 'https://antifakeshopcopy.brofirst.cn/api/common/upload',\r\n uploadFile: '',\r\n arr: [],\r\n cateList: [],\r\n curType: 0,\r\n typeId: 1,\r\n videoUrl: '',\r\n }\r\n },\r\n onLoad() {\r\n this.getTabsCate()\r\n this.getLocationHandler()\r\n },\r\n methods: {\r\n getLocationHandler() {\r\n uni.getLocation({\r\n type: 'wgs84',\r\n success: function (res) {\r\n console.log(res)\r\n console.log('当前位置的经度:' + res.longitude)\r\n console.log('当前位置的纬度:' + res.latitude)\r\n uni.request({\r\n\t\t url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=${'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'}`,\r\n\t\t data: {},\r\n\t\t success: (res2) => {\r\n\t\t console.log(res2, '腾讯地图打印');\r\n\t\t }\r\n\t\t})\r\n },\r\n fail(err){\r\n console.log(err)\r\n }\r\n })\r\n },\r\n // 切换图片 视频\r\n toggeleHandler(isImg) {\r\n if (isImg === 0) {\r\n this.viList = []\r\n this.isImg = true\r\n this.status = 'image'\r\n } else {\r\n this.viList = []\r\n this.isImg = false\r\n this.status = 'video'\r\n }\r\n },\r\n\r\n // async chooseVideoHandler(state) {\r\n // uni.showLoading({\r\n // mask: true,\r\n // title: '上传中...',\r\n // })\r\n // // try {\r\n // // 1.选择要上传的视频\r\n // const res = await uni.chooseMedia({\r\n // maxDuration: 60,\r\n // sourceType: ['album'],\r\n // mediaType: Array(this.status),\r\n\r\n // })\r\n // // let uploadFile = ''\r\n // // 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath\r\n // this.uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles[0].tempFilePath\r\n // var that = this\r\n // // } catch (error) {\r\n // // console.log(error)\r\n // // uni.hideLoading()\r\n // // }\r\n // this.arr = await uni.uploadFile({\r\n // // 需要上传的地址\r\n // url: that.vue_uploadAction,\r\n // // filePath 需要上传的文件\r\n // filePath: that.uploadFile,\r\n // name: 'file',\r\n // header: {\r\n // \ttoken: \"781bb514-342d-4a67-9086-758b4e6477c0\"\t\t// 挂载请求头为用户的 token\r\n // },\r\n // })\r\n // let data = JSON.parse(this.arr[1].data)\r\n // console.log('data:', data)\r\n // if (data.code !== 1) {\r\n // // 视频上传失败了\r\n // uni.hideLoading()\r\n // uni.showToast({\r\n // title: data.msg,\r\n // icon: 'none',\r\n // })\r\n // return\r\n // }\r\n // // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n // this.viList.push({\r\n // image: data.data.fullurl,\r\n // type: this.status == 'video' ? 'v' : 'i',\r\n // })\r\n // uni.hideLoading()\r\n // },\r\n async chooseVideoHandler() {\r\n try {\r\n uni.showLoading({\r\n mask: true,\r\n title: '上传中...',\r\n })\r\n let uploadFile = ''\r\n // 1.选择要上传的视频\r\n const res = await uni.chooseMedia({\r\n maxDuration: 60,\r\n sourceType: ['album'],\r\n count: this.status == 'video' ? 1 : 9,\r\n mediaType: Array(this.status),\r\n })\r\n // console.log(res[1].tempFiles[0], 'url')\r\n // 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath\r\n this.status == 'video' && (this.videoUrl = res[1].tempFiles[0].tempFilePath)\r\n uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles[0].tempFilePath\r\n var that = this\r\n const arr = await uni.uploadFile({\r\n // 需要上传的地址\r\n url: that.vue_uploadAction,\r\n // filePath 需要上传的文件\r\n filePath: uploadFile,\r\n name: 'file',\r\n header: {\r\n token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token\r\n },\r\n })\r\n let data = JSON.parse(arr[1].data)\r\n console.log('data:', data)\r\n if (data.code !== 1) {\r\n // 视频上传失败了\r\n uni.hideLoading()\r\n uni.showToast({\r\n title: data.msg,\r\n icon: 'none',\r\n })\r\n return\r\n }\r\n // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n this.viList.push({\r\n image: data.data.fullurl,\r\n type: this.status == 'video' ? 'v' : 'i',\r\n })\r\n uni.hideLoading()\r\n } catch (error) {\r\n // console.log(error)\r\n uni.hideLoading()\r\n }\r\n },\r\n previewImageHandler(type) {\r\n type === 'i' &&\r\n uni.previewImage({\r\n urls: this.viList.filter(t => t.type === 'i').map(t => t.image),\r\n })\r\n },\r\n delHandler(index) {\r\n this.viList.splice(index, 1)\r\n },\r\n\r\n async getTabsCate() {\r\n const { data } = await getTabsCate({\r\n page: 1,\r\n rows: 10,\r\n })\r\n console.log(data)\r\n this.cateList = data.data\r\n },\r\n\r\n toggleTypeHandler(id, index) {\r\n this.curType = index\r\n this.typeId = id\r\n // console.log(id,index)\r\n },\r\n\r\n // 创建接口\r\n async getAddItem() {\r\n if (this.titleValue.length == 0) {\r\n return uni.showToast({ title: '请填写标题', icon: 'none' })\r\n }\r\n if (this.value1.length == 0) {\r\n return uni.showToast({ title: '请填写内容', icon: 'none' })\r\n }\r\n if (this.viList.length == 0) {\r\n return uni.showToast({ title: '请上传图片或视频', icon: 'none' })\r\n }\r\n try {\r\n let VIList = {}\r\n if (this.status == 'video') {\r\n VIList = { video: this.videoUrl }\r\n } else {\r\n VIList = { imgList: this.viList.map(it => it.image) }\r\n }\r\n console.log(VIList)\r\n const res = await getAddItem({\r\n type_id: this.typeId, //\tinteger\t是\t类型ID\r\n title: this.titleValue, //\tstring\t是\t论坛标题\r\n content: this.value1, //\tstring\t是\t论坛内容\r\n file: VIList, //\tstring\t否\t文件json例如:{\"video\":\"http://sdsads\",\"imgList\":[\"\",\"\",\"\"]}\r\n })\r\n uni.showToast({ title: '发布成功' })\r\n console.log(res, 'fabufabu')\r\n } catch (error) {\r\n console.log(error)\r\n }\r\n },\r\n },\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\npage {\r\n background: #fff;\r\n}\r\n.mainBox {\r\n padding: 0 32rpx 32rpx;\r\n box-sizing: border-box;\r\n}\r\n.whiteBox {\r\n width: 100%;\r\n height: 60rpx;\r\n background: #fff;\r\n position: fixed;\r\n bottom: 0;\r\n left: 0;\r\n}\r\n.bottomBtn {\r\n padding: 16rpx 32rpx;\r\n box-sizing: border-box;\r\n background: #fff;\r\n position: fixed;\r\n bottom: 60rpx;\r\n left: 0;\r\n view {\r\n width: 686rpx;\r\n height: 88rpx;\r\n border-radius: 28rpx;\r\n background: linear-gradient(90deg, rgba(140, 72, 255, 1) 0%, rgba(123, 43, 255, 1) 100%);\r\n color: rgba(255, 255, 255, 1);\r\n font-size: 32rpx;\r\n font-weight: 700;\r\n }\r\n}\r\n.u-textarea {\r\n border: none !important;\r\n}\r\n.stateBox {\r\n margin-top: 16rpx;\r\n margin-bottom: 28rpx;\r\n width: 228rpx;\r\n height: 56rpx;\r\n border-radius: 200rpx;\r\n background: #f6f8fa;\r\n > .item {\r\n width: 50%;\r\n height: 100%;\r\n color: rgba(0, 0, 0, 0.4);\r\n font-size: 26rpx;\r\n }\r\n}\r\n.Z {\r\n background: #f1e8ff;\r\n border: 1rpx solid #b88dff;\r\n color: #6e16ff;\r\n font-size: 26rpx;\r\n border-radius: 200rpx;\r\n font-weight: 700;\r\n}\r\n.uploadImage {\r\n display: flex;\r\n flex-wrap: wrap;\r\n}\r\n.aa {\r\n margin-right: 20rpx;\r\n position: relative;\r\n > .del {\r\n position: absolute;\r\n top: 0;\r\n left: 8rpx;\r\n z-index: 999;\r\n color: #fff;\r\n font-size: 32rpx;\r\n }\r\n > .sty {\r\n width: 160rpx;\r\n height: 160rpx;\r\n }\r\n > .jinzhi {\r\n width: 160rpx;\r\n height: 160rpx;\r\n background: transparent;\r\n position: absolute;\r\n z-index: 998;\r\n top: 0;\r\n left: 0;\r\n }\r\n}\r\n.typeBox {\r\n width: 48rpx;\r\n height: 48rpx;\r\n border-radius: 50%;\r\n position: absolute;\r\n left: 50%;\r\n top: 50%;\r\n transform: translate(-50%, -50%);\r\n /* top: 0;\r\n right: 0; */\r\n}\r\n.btnBox {\r\n /* margin: 0 auto; */\r\n margin-bottom: 28rpx;\r\n /* margin-left: 20rpx; */\r\n width: 160rpx;\r\n height: 160rpx;\r\n margin-top: 20rpx;\r\n background: #f4f5f7;\r\n color: #000;\r\n}\r\n.cateBox {\r\n flex-wrap: wrap;\r\n > .cateText {\r\n color: rgba(0, 0, 0, 0.9);\r\n font-size: 28rpx;\r\n font-weight: 700;\r\n margin-right: 8rpx;\r\n }\r\n > .typeBox1 {\r\n padding: 8rpx 12rpx;\r\n box-sizing: border-box;\r\n border-radius: 154rpx;\r\n border: 1rpx solid transparent;\r\n background: rgba(247, 248, 250, 1);\r\n color: rgba(0, 0, 0, 0.9);\r\n margin-right: 24rpx;\r\n font-size: 24rpx;\r\n }\r\n > .ZZ {\r\n background: rgba(110, 22, 255, 0.1);\r\n border: 1rpx solid #b88dff;\r\n color: rgba(110, 22, 255, 1);\r\n }\r\n}\r\n</style>\r\n"
,
"import mod from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=style&index=0&lang=scss&\""
,
"// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1670310491920\n var cssReload = require(\"D:/高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"../../\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "
],
"sourceRoot"
:
""
}
\ No newline at end of file
{
"version"
:
3
,
"sources"
:[
"uni-app:///main.js"
,
null
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?0a0e"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?dbe1"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?d3fd"
,
"uni-app:///pages/index/addItem.vue"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?8d90"
,
"webpack:///D:/vue/kaoshi3-fangweishangcheng/pages/index/addItem.vue?adf3"
],
"names"
:[
"wx"
,
"__webpack_require_UNI_MP_PLUGIN__"
,
"__webpack_require__"
,
"createPage"
,
"Page"
],
"mappings"
:
";;;;;;;;;;kDAAA;AACA;AACA,iG,6FAFmBA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC;AAGnBC,UAAU,CAACC,gBAAD,CAAV,C;;;;;;;;;;;;;ACHA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAoH;AACpH;AAC2D;AACL;AACc;;;AAGpE;AAC0K;AAC1K,gBAAgB,6KAAU;AAC1B,EAAE,6EAAM;AACR,EAAE,kFAAM;AACR,EAAE,2FAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,sFAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,iSAEN;AACP,KAAK;AACL;AACA,aAAa,uSAEN;AACP,KAAK;AACL;AACA,aAAa,iSAEN;AACP,KAAK;AACL;AACA,aAAa,mTAEN;AACP,KAAK;AACL;AACA,aAAa,qRAEN;AACP;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACrDA;AAAA;AAAA;AAAA;AAAuoB,CAAgB,inBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC0D3pB,iD;AACA;AACA,MADA,kBACA;AACA;AACA,iBADA;AAEA;AACA,oBAHA;AAIA;AACA,gBALA;AAMA,qBANA;AAOA,gBAPA;AAQA,gFARA;AASA,oBATA;AAUA,aAVA;AAWA,kBAXA;AAYA,gBAZA;AAaA,eAbA;AAcA,kBAdA;;AAgBA,GAlBA;AAmBA,QAnBA,oBAmBA;AACA;AACA;AACA,GAtBA;AAuBA;AACA,sBADA,gCACA;AACA;AACA,qBADA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBADA;AAEA,iDAFA,CADA;AAIA,oBAJA;AAKA;AACA;AACA,aAPA;;AASA,SAfA;AAgBA,YAhBA,gBAgBA,GAhBA,EAgBA;AACA;AACA,SAlBA;;AAoBA,KAtBA;AAuBA;AACA,kBAxBA,0BAwBA,KAxBA,EAwBA;AACA;AACA;AACA;AACA;AACA,OAJA,MAIA;AACA;AACA;AACA;AACA;AACA,KAlCA;;AAoCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBArFA,gCAqFA;;AAEA;AACA,4BADA;AAEA,iCAFA;;AAIA,0BANA,GAMA,EANA;AAOA;AAPA,yCAQA;AACA,iCADA;AAEA,uCAFA;AAGA,wDAHA;AAIA,gDAJA,GARA,QAQA,GARA;;AAcA;AACA;AACA;AACA;AACA;AACA,oBAnBA,GAmBA,KAnBA;AAoBA,wCApBA;AAqBA,uCArBA;AAsBA;AACA;AACA,8CAFA;AAGA;AACA,wCAJA;AAKA,gCALA;AAMA;AACA,mEADA,CACA;AADA,qBANA,GAtBA,UAsBA,GAtBA;;AAgCA,oBAhCA,GAgCA,uBAhCA;AAiCA,2CAjCA;AAkCA,+BAlCA;AAmCA;AACA;AACA;AACA,iCADA;AAEA,8BAFA,IArCA;;;;AA2CA;AACA;AACA,0CADA;AAEA,2DAFA;;AAIA;AACA,kCAjDA;;;AAoDA,uCApDA;AAqDA,iBArDA,GAqDA,CArDA,eAqDA,qBArDA;AAsDA;AACA;AACA,8CAFA;AAGA;AACA,2CAJA;AAKA,gCALA;AAMA;AACA,mEADA,CACA;AADA,qBANA,GAtDA,UAsDA,GAtDA;;AAgEA,qBAhEA,GAgEA,uBAhEA;AAiEA,4CAjEA;AAkEA,gCAlEA;AAmEA;AACA;AACA;AACA,kCADA;AAEA,8BAFA,IArEA;;;;AA2EA;AACA;AACA,2CADA;AAEA,2DAFA;;AAIA;AACA,kCAjFA,QAqDA,GArDA;;;;;;;;;;;;;;;;;;;;;;AAuGA;AACA,kCAxGA;;AA0GA,KA/LA;AAgMA,uBAhMA,+BAgMA,IAhMA,EAgMA;AACA;AACA;AACA,2GADA,GADA;;AAIA,KArMA;AAsMA,cAtMA,sBAsMA,KAtMA,EAsMA;AACA;AACA,KAxMA;;AA0MA,eA1MA,yBA0MA;AACA;AACA,2BADA;AAEA,4BAFA,GADA,8CACA,IADA,uBACA,IADA;;AAKA;AACA,4CANA;AAOA,KAjNA;;AAmNA,qBAnNA,6BAmNA,EAnNA,EAmNA,KAnNA,EAmNA;AACA;AACA;AACA;AACA,KAvNA;;AAyNA;AACA,cA1NA,wBA0NA;AACA,6CADA;AAEA,+DAFA;;AAIA,yCAJA;AAKA,+DALA;;AAOA,yCAPA;AAQA,kEARA;;;AAWA,sBAXA,GAWA,EAXA;AAYA;AACA;AACA,iBAFA,MAEA;AACA;AACA;AACA,oCAjBA;AAkBA;AACA,0CADA,EACA;AACA,4CAFA,EAEA;AACA,0CAHA,EAGA;AACA,gCAJA,CAIA;AAJA,oBAlBA,UAkBA,GAlBA;AAwBA;AACA;AACA,6CA1BA;;AA4BA,0CA5BA;;AA8BA,KAxPA,EAvBA,E;;;;;;;;;;;;;AC3DA;AAAA;AAAA;AAAA;AAA8sC,CAAgB,gmCAAG,EAAC,C;;;;;;;;;;;ACAluC;AACA,OAAO,KAAU,EAAE,kBAKd"
,
"file"
:
"pages/index/addItem.js"
,
"sourcesContent"
:[
"import 'uni-pages';wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/index/addItem.vue'\ncreatePage(Page)"
,
"import { render, staticRenderFns, recyclableRender, components } from \"./addItem.vue?vue&type=template&id=6465dbee&\"\nvar renderjs\nimport script from \"./addItem.vue?vue&type=script&lang=js&\"\nexport * from \"./addItem.vue?vue&type=script&lang=js&\"\nimport style0 from \"./addItem.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"pages/index/addItem.vue\"\nexport default component.exports"
,
"export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=template&id=6465dbee&\""
,
"var components\ntry {\n components = {\n uNavbar: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-navbar/u-navbar\" */ \"uview-ui/components/u-navbar/u-navbar.vue\"\n )\n },\n uDivider: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-divider/u-divider\" */ \"uview-ui/components/u-divider/u-divider.vue\"\n )\n },\n \"u-Input\": function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u--input/u--input\" */ \"uview-ui/components/u--input/u--input.vue\"\n )\n },\n \"u-Textarea\": function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u--textarea/u--textarea\" */ \"uview-ui/components/u--textarea/u--textarea.vue\"\n )\n },\n uIcon: function() {\n return import(\n /* webpackChunkName: \"node-modules/uview-ui/components/u-icon/u-icon\" */ \"uview-ui/components/u-icon/u-icon.vue\"\n )\n }\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }"
,
"import mod from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=script&lang=js&\""
,
"<template>\r\n <view>\r\n <u-navbar title=\"话题详情\" :autoBack=\"true\" placeholder></u-navbar>\r\n <u-divider></u-divider>\r\n <view class=\"mainBox\">\r\n <u--input placeholder=\"请输入标题\" border=\"bottom\" v-model=\"titleValue\" clearable></u--input>\r\n </view>\r\n\r\n <!-- 选择格式发布 -->\r\n <view class=\"mainBox\">\r\n <view class=\"stateBox flexA\">\r\n <view class=\"item flexC\" :class=\"[isImg && 'Z']\" @click=\"toggeleHandler(0)\">图片</view>\r\n <view class=\"item flexC\" :class=\"[!isImg && 'Z']\" @click=\"toggeleHandler(1)\">视频</view>\r\n </view>\r\n\r\n <u--textarea v-model=\"value1\" placeholder=\"请输入内容\"></u--textarea>\r\n\r\n <!-- 上传 -->\r\n <view class=\"uploadImage flexA\">\r\n <view v-for=\"(item, index) in viList\" class=\"aa\" :key=\"index\">\r\n <view class=\"del\" @click=\"delHandler(index)\">×</view>\r\n <image v-if=\"item.type === 'v'\" class=\"typeBox\" src=\"/static/player.png\" mode=\"scaleToFill\" />\r\n <!-- <view >视频格式</view> -->\r\n <image class=\"sty\" :src=\"item.image\" @click=\"previewImageHandler(item.type)\" mode=\"scaleToFill\" />\r\n </view>\r\n <view\r\n @click=\"chooseVideoHandler('video')\"\r\n class=\"flexC btnBox\"\r\n v-if=\"(status == 'video' && !viList.length) || (status == 'image' && viList.length < 9)\"\r\n >\r\n <u-icon name=\"camera-fill\"></u-icon>\r\n </view>\r\n </view>\r\n <u-divider></u-divider>\r\n\r\n <!-- 分类 -->\r\n <view class=\"cateBox flexA\">\r\n <view class=\"cateText\">话题分类:</view>\r\n <view\r\n v-for=\"(item, index) in cateList\"\r\n class=\"typeBox1 flexC\"\r\n @click=\"toggleTypeHandler(item.id, index)\"\r\n :class=\"[curType == index && 'ZZ']\"\r\n >\r\n {{ item.type_name }}\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <view class=\"bottomBtn\">\r\n <view class=\"flexC\" @click=\"getAddItem\">发表</view>\r\n </view>\r\n <view class=\"whiteBox\"></view>\r\n <view style=\"height: 130rpx\"></view>\r\n </view>\r\n</template>\r\n\r\n<script>\r\nimport { getAddItem, getTabsCate } from '@/api'\r\nexport default {\r\n data() {\r\n return {\r\n isImg: true,\r\n // 标题\r\n titleValue: '',\r\n // 内容\r\n value1: '',\r\n status: 'image',\r\n viList: [],\r\n vue_uploadAction: 'https://antifakeshopcopy.brofirst.cn/api/common/upload',\r\n uploadFile: '',\r\n arr: [],\r\n cateList: [],\r\n curType: 0,\r\n typeId: 1,\r\n videoUrl: '',\r\n }\r\n },\r\n onLoad() {\r\n this.getTabsCate()\r\n this.getLocationHandler()\r\n },\r\n methods: {\r\n getLocationHandler() {\r\n uni.getLocation({\r\n type: 'wgs84',\r\n success: function (res) {\r\n console.log(res)\r\n console.log('当前位置的经度:' + res.longitude)\r\n console.log('当前位置的纬度:' + res.latitude)\r\n uni.request({\r\n url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${\r\n res.longitude\r\n }&key=${'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'}`,\r\n data: {},\r\n success: res2 => {\r\n console.log(res2, '腾讯地图打印')\r\n },\r\n })\r\n },\r\n fail(err) {\r\n console.log(err)\r\n },\r\n })\r\n },\r\n // 切换图片 视频\r\n toggeleHandler(isImg) {\r\n if (isImg === 0) {\r\n this.viList = []\r\n this.isImg = true\r\n this.status = 'image'\r\n } else {\r\n this.viList = []\r\n this.isImg = false\r\n this.status = 'video'\r\n }\r\n },\r\n\r\n // async chooseVideoHandler(state) {\r\n // uni.showLoading({\r\n // mask: true,\r\n // title: '上传中...',\r\n // })\r\n // // try {\r\n // // 1.选择要上传的视频\r\n // const res = await uni.chooseMedia({\r\n // maxDuration: 60,\r\n // sourceType: ['album'],\r\n // mediaType: Array(this.status),\r\n\r\n // })\r\n // // let uploadFile = ''\r\n // // 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath\r\n // this.uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles[0].tempFilePath\r\n // var that = this\r\n // // } catch (error) {\r\n // // console.log(error)\r\n // // uni.hideLoading()\r\n // // }\r\n // this.arr = await uni.uploadFile({\r\n // // 需要上传的地址\r\n // url: that.vue_uploadAction,\r\n // // filePath 需要上传的文件\r\n // filePath: that.uploadFile,\r\n // name: 'file',\r\n // header: {\r\n // \ttoken: \"781bb514-342d-4a67-9086-758b4e6477c0\"\t\t// 挂载请求头为用户的 token\r\n // },\r\n // })\r\n // let data = JSON.parse(this.arr[1].data)\r\n // console.log('data:', data)\r\n // if (data.code !== 1) {\r\n // // 视频上传失败了\r\n // uni.hideLoading()\r\n // uni.showToast({\r\n // title: data.msg,\r\n // icon: 'none',\r\n // })\r\n // return\r\n // }\r\n // // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n // this.viList.push({\r\n // image: data.data.fullurl,\r\n // type: this.status == 'video' ? 'v' : 'i',\r\n // })\r\n // uni.hideLoading()\r\n // },\r\n async chooseVideoHandler() {\r\n try {\r\n uni.showLoading({\r\n mask: true,\r\n title: '上传中...',\r\n })\r\n var uploadFile = ''\r\n // 1.选择要上传的视频\r\n const res = await uni.chooseMedia({\r\n maxDuration: 60,\r\n sourceType: ['album'],\r\n count: this.status == 'video' ? 1 : 9,\r\n mediaType: Array(this.status),\r\n })\r\n // console.log(res[1].tempFiles[0], 'url')\r\n // 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath\r\n console.log(res)\r\n this.status == 'video' && (this.videoUrl = res[1].tempFiles[0].tempFilePath)\r\n uploadFile = this.status == 'video' ? res[1].tempFiles[0].thumbTempFilePath : res[1].tempFiles.map(it => it.tempFilePath)\r\n var that = this\r\n console.log(uploadFile)\r\n if (this.status == 'video') {\r\n var arr = await uni.uploadFile({\r\n // 需要上传的地址\r\n url: that.vue_uploadAction,\r\n // filePath 需要上传的文件\r\n filePath: uploadFile,\r\n name: 'file',\r\n header: {\r\n token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token\r\n },\r\n })\r\n let data = JSON.parse(arr[1].data)\r\n console.log('data:', data)\r\n if (data.code !== 1) {\r\n // 视频上传失败了\r\n uni.hideLoading()\r\n uni.showToast({\r\n title: data.msg,\r\n icon: 'none',\r\n })\r\n return\r\n }\r\n // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n this.viList.push({\r\n image: data.data.fullurl,\r\n type: this.status == 'video' ? 'v' : 'i',\r\n })\r\n this.viList.length >1 && this.viList.splice(1,10)\r\n uni.hideLoading()\r\n }\r\n\r\n if(this.status == 'image'){\r\n for (let i = 0; i < uploadFile.length; i++) {\r\n var arr = await uni.uploadFile({\r\n // 需要上传的地址\r\n url: that.vue_uploadAction,\r\n // filePath 需要上传的文件\r\n filePath: uploadFile[i],\r\n name: 'file',\r\n header: {\r\n token: '781bb514-342d-4a67-9086-758b4e6477c0', // 挂载请求头为用户的 token\r\n },\r\n })\r\n let data = JSON.parse(arr[1].data)\r\n console.log('data:', data)\r\n if (data.code !== 1) {\r\n // 视频上传失败了\r\n uni.hideLoading()\r\n uni.showToast({\r\n title: data.msg,\r\n icon: 'none',\r\n })\r\n return\r\n }\r\n // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n this.viList.push({\r\n image: data.data.fullurl,\r\n type: this.status == 'video' ? 'v' : 'i',\r\n })\r\n this.viList.length >9 && this.viList.splice(9,10)\r\n uni.hideLoading()\r\n }\r\n }\r\n\r\n // let data = JSON.parse(arr[1].data)\r\n // console.log('data:', data)\r\n // if (data.code !== 1) {\r\n // // 视频上传失败了\r\n // uni.hideLoading()\r\n // uni.showToast({\r\n // title: data.msg,\r\n // icon: 'none',\r\n // })\r\n // return\r\n // }\r\n // // 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)\r\n // this.viList.push({\r\n // image: data.data.fullurl,\r\n // type: this.status == 'video' ? 'v' : 'i',\r\n // })\r\n // uni.hideLoading()\r\n } catch (error) {\r\n // console.log(error)\r\n uni.hideLoading()\r\n }\r\n },\r\n previewImageHandler(type) {\r\n type === 'i' &&\r\n uni.previewImage({\r\n urls: this.viList.filter(t => t.type === 'i').map(t => t.image),\r\n })\r\n },\r\n delHandler(index) {\r\n this.viList.splice(index, 1)\r\n },\r\n\r\n async getTabsCate() {\r\n const { data } = await getTabsCate({\r\n page: 1,\r\n rows: 10,\r\n })\r\n console.log(data)\r\n this.cateList = data.data\r\n },\r\n\r\n toggleTypeHandler(id, index) {\r\n this.curType = index\r\n this.typeId = id\r\n // console.log(id,index)\r\n },\r\n\r\n // 创建接口\r\n async getAddItem() {\r\n if (this.titleValue.length == 0) {\r\n return uni.showToast({ title: '请填写标题', icon: 'none' })\r\n }\r\n if (this.value1.length == 0) {\r\n return uni.showToast({ title: '请填写内容', icon: 'none' })\r\n }\r\n if (this.viList.length == 0) {\r\n return uni.showToast({ title: '请上传图片或视频', icon: 'none' })\r\n }\r\n try {\r\n let VIList = {}\r\n if (this.status == 'video') {\r\n VIList = { video: this.videoUrl }\r\n } else {\r\n VIList = { imgList: this.viList.map(it => it.image) }\r\n }\r\n console.log(VIList)\r\n const res = await getAddItem({\r\n type_id: this.typeId, //\tinteger\t是\t类型ID\r\n title: this.titleValue, //\tstring\t是\t论坛标题\r\n content: this.value1, //\tstring\t是\t论坛内容\r\n file: VIList, //\tstring\t否\t文件json例如:{\"video\":\"http://sdsads\",\"imgList\":[\"\",\"\",\"\"]}\r\n })\r\n uni.showToast({ title: '发布成功' })\r\n uni.navigateBack({ delta: 1 })\r\n console.log(res, 'fabufabu')\r\n } catch (error) {\r\n console.log(error)\r\n }\r\n },\r\n },\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\">\r\npage {\r\n background: #fff;\r\n}\r\n.mainBox {\r\n padding: 0 32rpx 32rpx;\r\n box-sizing: border-box;\r\n}\r\n.whiteBox {\r\n width: 100%;\r\n height: 60rpx;\r\n background: #fff;\r\n position: fixed;\r\n bottom: 0;\r\n left: 0;\r\n}\r\n.bottomBtn {\r\n padding: 16rpx 32rpx;\r\n box-sizing: border-box;\r\n background: #fff;\r\n position: fixed;\r\n bottom: 60rpx;\r\n left: 0;\r\n view {\r\n width: 686rpx;\r\n height: 88rpx;\r\n border-radius: 28rpx;\r\n background: linear-gradient(90deg, rgba(140, 72, 255, 1) 0%, rgba(123, 43, 255, 1) 100%);\r\n color: rgba(255, 255, 255, 1);\r\n font-size: 32rpx;\r\n font-weight: 700;\r\n }\r\n}\r\n.u-textarea {\r\n border: none !important;\r\n}\r\n.stateBox {\r\n margin-top: 16rpx;\r\n margin-bottom: 28rpx;\r\n width: 228rpx;\r\n height: 56rpx;\r\n border-radius: 200rpx;\r\n background: #f6f8fa;\r\n > .item {\r\n width: 50%;\r\n height: 100%;\r\n color: rgba(0, 0, 0, 0.4);\r\n font-size: 26rpx;\r\n }\r\n}\r\n.Z {\r\n background: #f1e8ff;\r\n border: 1rpx solid #b88dff;\r\n color: #6e16ff;\r\n font-size: 26rpx;\r\n border-radius: 200rpx;\r\n font-weight: 700;\r\n}\r\n.uploadImage {\r\n display: flex;\r\n flex-wrap: wrap;\r\n}\r\n.aa {\r\n margin-right: 20rpx;\r\n position: relative;\r\n > .del {\r\n position: absolute;\r\n top: 0;\r\n left: 8rpx;\r\n z-index: 999;\r\n color: #fff;\r\n font-size: 32rpx;\r\n }\r\n > .sty {\r\n width: 160rpx;\r\n height: 160rpx;\r\n }\r\n > .jinzhi {\r\n width: 160rpx;\r\n height: 160rpx;\r\n background: transparent;\r\n position: absolute;\r\n z-index: 998;\r\n top: 0;\r\n left: 0;\r\n }\r\n}\r\n.typeBox {\r\n width: 48rpx;\r\n height: 48rpx;\r\n border-radius: 50%;\r\n position: absolute;\r\n left: 50%;\r\n top: 50%;\r\n transform: translate(-50%, -50%);\r\n /* top: 0;\r\n right: 0; */\r\n}\r\n.btnBox {\r\n /* margin: 0 auto; */\r\n margin-bottom: 28rpx;\r\n /* margin-left: 20rpx; */\r\n width: 160rpx;\r\n height: 160rpx;\r\n margin-top: 20rpx;\r\n background: #f4f5f7;\r\n color: #000;\r\n}\r\n.cateBox {\r\n flex-wrap: wrap;\r\n > .cateText {\r\n color: rgba(0, 0, 0, 0.9);\r\n font-size: 28rpx;\r\n font-weight: 700;\r\n margin-right: 8rpx;\r\n }\r\n > .typeBox1 {\r\n padding: 8rpx 12rpx;\r\n box-sizing: border-box;\r\n border-radius: 154rpx;\r\n border: 1rpx solid transparent;\r\n background: rgba(247, 248, 250, 1);\r\n color: rgba(0, 0, 0, 0.9);\r\n margin-right: 24rpx;\r\n font-size: 24rpx;\r\n }\r\n > .ZZ {\r\n background: rgba(110, 22, 255, 0.1);\r\n border: 1rpx solid #b88dff;\r\n color: rgba(110, 22, 255, 1);\r\n }\r\n}\r\n</style>\r\n"
,
"import mod from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./addItem.vue?vue&type=style&index=0&lang=scss&\""
,
"// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1670315679557\n var cssReload = require(\"D:/高级前台制作/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"../../\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "
],
"sourceRoot"
:
""
}
\ No newline at end of file
...
...
unpackage/dist/dev/mp-weixin/pages/index/addItem.js
查看文件 @
9bd5b01
...
...
@@ -256,7 +256,9 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
console
.
log
(
'当前位置的经度:'
+
res
.
longitude
);
console
.
log
(
'当前位置的纬度:'
+
res
.
latitude
);
uni
.
request
({
url
:
"https://apis.map.qq.com/ws/geocoder/v1/?location="
.
concat
(
res
.
latitude
,
","
).
concat
(
res
.
longitude
,
"&key="
,
'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'
),
url
:
"https://apis.map.qq.com/ws/geocoder/v1/?location="
.
concat
(
res
.
latitude
,
","
).
concat
(
res
.
longitude
,
"&key="
,
'BT4BZ-MVGLR-NVEWD-W5KMR-7OAZJ-3GFX2'
),
data
:
{},
success
:
function
success
(
res2
)
{
console
.
log
(
res2
,
'腾讯地图打印'
);
...
...
@@ -330,7 +332,7 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
// })
// uni.hideLoading()
// },
chooseVideoHandler
:
function
chooseVideoHandler
()
{
var
_this
=
this
;
return
_asyncToGenerator
(
/*#__PURE__*/
_regenerator
.
default
.
mark
(
function
_callee
()
{
var
uploadFile
,
res
,
that
,
arr
,
data
;
return
_regenerator
.
default
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
_context
.
prev
=
0
;
chooseVideoHandler
:
function
chooseVideoHandler
()
{
var
_this
=
this
;
return
_asyncToGenerator
(
/*#__PURE__*/
_regenerator
.
default
.
mark
(
function
_callee
()
{
var
uploadFile
,
res
,
that
,
arr
,
data
,
i
,
_data
;
return
_regenerator
.
default
.
wrap
(
function
_callee$
(
_context
)
{
while
(
1
)
{
switch
(
_context
.
prev
=
_context
.
next
)
{
case
0
:
_context
.
prev
=
0
;
uni
.
showLoading
({
mask
:
true
,
...
...
@@ -346,9 +348,12 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
// console.log(res[1].tempFiles[0], 'url')
// 判断函数传来的类型是不是视频 如果是就使用视频缩略图 => thumbTempFilePath
console
.
log
(
res
);
_this
.
status
==
'video'
&&
(
_this
.
videoUrl
=
res
[
1
].
tempFiles
[
0
].
tempFilePath
);
uploadFile
=
_this
.
status
==
'video'
?
res
[
1
].
tempFiles
[
0
].
thumbTempFilePath
:
res
[
1
].
tempFiles
[
0
].
tempFilePath
;
that
=
_this
;
_context
.
next
=
11
;
return
(
uploadFile
=
_this
.
status
==
'video'
?
res
[
1
].
tempFiles
[
0
].
thumbTempFilePath
:
res
[
1
].
tempFiles
.
map
(
function
(
it
)
{
return
it
.
tempFilePath
;});
that
=
_this
;
console
.
log
(
uploadFile
);
if
(
!
(
_this
.
status
==
'video'
))
{
_context
.
next
=
24
;
break
;}
_context
.
next
=
14
;
return
(
uni
.
uploadFile
({
// 需要上传的地址
url
:
that
.
vue_uploadAction
,
...
...
@@ -357,16 +362,16 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
name
:
'file'
,
header
:
{
token
:
'781bb514-342d-4a67-9086-758b4e6477c0'
// 挂载请求头为用户的 token
}
}));
case
1
1
:
arr
=
_context
.
sent
;
}
}));
case
1
4
:
arr
=
_context
.
sent
;
data
=
JSON
.
parse
(
arr
[
1
].
data
);
console
.
log
(
'data:'
,
data
);
if
(
!
(
data
.
code
!==
1
))
{
_context
.
next
=
18
;
break
;}
data
.
code
!==
1
))
{
_context
.
next
=
21
;
break
;}
// 视频上传失败了
uni
.
hideLoading
();
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
});
return
_context
.
abrupt
(
"return"
);
case
18
:
icon
:
'none'
});
return
_context
.
abrupt
(
"return"
);
case
21
:
...
...
@@ -375,10 +380,63 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
image
:
data
.
data
.
fullurl
,
type
:
_this
.
status
==
'video'
?
'v'
:
'i'
});
uni
.
hideLoading
();
_context
.
next
=
25
;
break
;
case
22
:
_context
.
prev
=
22
;
_context
.
t0
=
_context
[
"catch"
](
0
);
_this
.
viList
.
length
>
1
&&
_this
.
viList
.
splice
(
1
,
10
);
uni
.
hideLoading
();
case
24
:
if
(
!
(
_this
.
status
==
'image'
))
{
_context
.
next
=
42
;
break
;}
i
=
0
;
case
26
:
if
(
!
(
i
<
uploadFile
.
length
))
{
_context
.
next
=
42
;
break
;}
_context
.
next
=
29
;
return
(
uni
.
uploadFile
({
// 需要上传的地址
url
:
that
.
vue_uploadAction
,
// filePath 需要上传的文件
filePath
:
uploadFile
[
i
],
name
:
'file'
,
header
:
{
token
:
'781bb514-342d-4a67-9086-758b4e6477c0'
// 挂载请求头为用户的 token
}
}));
case
29
:
arr
=
_context
.
sent
;
_data
=
JSON
.
parse
(
arr
[
1
].
data
);
console
.
log
(
'data:'
,
_data
);
if
(
!
(
_data
.
code
!==
1
))
{
_context
.
next
=
36
;
break
;}
// 视频上传失败了
uni
.
hideLoading
();
uni
.
showToast
({
title
:
_data
.
msg
,
icon
:
'none'
});
return
_context
.
abrupt
(
"return"
);
case
36
:
// 上传成功(把上传成功后的文件路径 push 到页面需要显示的视频数据列表中)
_this
.
viList
.
push
({
image
:
_data
.
data
.
fullurl
,
type
:
_this
.
status
==
'video'
?
'v'
:
'i'
});
_this
.
viList
.
length
>
9
&&
_this
.
viList
.
splice
(
9
,
10
);
uni
.
hideLoading
();
case
39
:
i
++
;
_context
.
next
=
26
;
break
;
case
42
:
_context
.
next
=
47
;
break
;
case
44
:
_context
.
prev
=
44
;
_context
.
t0
=
_context
[
"catch"
](
0
);
// console.log(error)
uni
.
hideLoading
();
case
25
:
case
"end"
:
return
_context
.
stop
();}}},
_callee
,
null
,
[[
0
,
22
]]);}))();
uni
.
hideLoading
();
case
47
:
case
"end"
:
return
_context
.
stop
();}}},
_callee
,
null
,
[[
0
,
44
]]);}))();
},
previewImageHandler
:
function
previewImageHandler
(
type
)
{
...
...
@@ -432,9 +490,10 @@ var _api = __webpack_require__(/*! @/api */ 142);function _interopRequireDefault
file
:
VIList
// string 否 文件json例如:{"video":"http://sdsads","imgList":["","",""]}
}));
case
12
:
res
=
_context3
.
sent
;
uni
.
showToast
({
title
:
'发布成功'
});
console
.
log
(
res
,
'fabufabu'
);
_context3
.
next
=
20
;
break
;
case
17
:
_context3
.
prev
=
17
;
_context3
.
t0
=
_context3
[
"catch"
](
6
);
uni
.
navigateBack
({
delta
:
1
});
console
.
log
(
res
,
'fabufabu'
);
_context3
.
next
=
21
;
break
;
case
18
:
_context3
.
prev
=
18
;
_context3
.
t0
=
_context3
[
"catch"
](
6
);
console
.
log
(
_context3
.
t0
);
case
2
0
:
case
"end"
:
return
_context3
.
stop
();}}},
_callee3
,
null
,
[[
6
,
17
]]);}))();
console
.
log
(
_context3
.
t0
);
case
2
1
:
case
"end"
:
return
_context3
.
stop
();}}},
_callee3
,
null
,
[[
6
,
18
]]);}))();
}
}
};
exports
.
default
=
_default
;
/* WEBPACK VAR INJECTION */
}.
call
(
this
,
__webpack_require__
(
/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */
1
)[
"default"
]))
...
...
请
注册
或
登录
后发表评论