| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view style="position: fixed;top: 40px;background-color: #fff;z-index: 99;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="详情"></uni-nav-bar>
- </view>
- <view style="position: relative;top: 90px;">
- <view class="partitlteimg">
- <!-- <image :src="list" mode="" class="" @click="examine(list)"></image> -->
- <u-swiper :list="list" height='428' @click="examine(list)"></u-swiper>
- </view>
- <view class="quiz">
- <view class="quiz_username">
- <image
- :src="$imageURL+'/bigdata_app'+'/image/expertDiagnosis/6940a11a251770f1b0d8b7b10ebdf9b.png'"
- mode="" v-if="Number(quizdata.heat)==1"></image>
- <span>{{quizdata.title}}</span>
- </view>
- <view class="quiz_usertime">
- <view style="display: flex;align-items: center;">
- <image :src="quizdata.image?quizdata.image:$imageURL+'/bigdata_app/image/fourMoodBase/touxiang.png'"
- mode=""></image>
- <span>{{quizdata.username}}</span>
- </view>
- <view>
- <span>{{quizdata.adtime|timeFormat()}}</span>
- </view>
- </view>
- <view class="quiz_usercontert" v-html="quizdata.content"></view>
- </view>
- <view class="comment">
- <p class="comment_title">评论</p>
- <scroll-view class="scroll-view_H" :scroll-y="true" @scrolltolower="scroll" scroll-top="0">
- <view class="comment_unit" v-for="(item,index) in commentdata" :key="index">
- <view class="comment_unit_user">
- <view class="username">
- <image :src="item.image" mode=""></image>
- <span style="font-size: 26rpx;color:#C1C1C1;">{{item.username}}</span>
- <p v-if="Number(item.user_type) == 1">专家</p>
- </view>
- <view>
- <span style="font-size: 26rpx;color:#C1C1C1;">{{item.uptime|timeFormat()}}</span>
- </view>
- </view>
- <view class="comment_unit_con">
- <p v-html="item.content"></p>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <view class="issue_box" :style="{position: 'fixed',bottom: height+'px'}">
- <view class="issue">
- <input type="text" v-model="issuedata" @focus="focus" :auto-blur="true" :adjust-position='false'
- @blur="blur" @confirm="confirm" />
- <p @click="issue">发布</p>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- quizdata: {},
- commentdata: [],
- issuedata: '',
- defaultimg: '/images/expertDiagnosis/img01.png',
- height: 0,
- page: 1,
- }
- },
- methods: { //
- async getParticulars(datas) { //获取评论列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=pest.pests.pests_answers_list',
- data: {
- lower: datas,
- page: this.page,
- page_size: 10
- }
- })
- this.commentdata = this.commentdata.concat(res.data)
- console.log(res.data)
- },
- async getDiscuss(data) { //发布评论
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=pest.pests.pests_new_idea',
- data: {
- lower: data.lower,
- content: data.content,
- }
- })
- if (res.code == 200) {
- this.commentdata = []
- this.page = 1
- this.getParticulars(this.quizdata.lower)
- }
- console.log(res)
- },
- clickLeft() {
- uni.navigateTo({
- url: "./exchangeShare"
- })
- },
- issue() { //发布评论
- let obj = {}
- obj.lower = this.quizdata.lower
- obj.content = this.issuedata
- if (this.issuedata != '') {
- this.getDiscuss(obj)
- this.issuedata = ''
- }
- },
- focus(e) {
- this.height = e.detail.height
- },
- blur() {
- this.height = 0
- },
- confirm() {
- this.issue()
- },
- scroll(e) {
- this.page++
- this.getParticulars(this.quizdata.lower)
- },
- examine(list) {
- console.log(list)
- var imgarr = []
- for(var i=0;i<list.length;i++){
- imgarr.unshift(list[0].image)
- }
- console.log(imgarr)
- uni.previewImage({
- urls: imgarr
- });
- },
- async getInvitation(id) { //获取点击的帖子详细内容
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=pest.pests.pests_answers_list',
- data: {
- d_id: id,
- page: this.page,
- page_size: 10
- }
- })
- console.log(res)
- this.quizdata = res.data[0]
- console.log(this.quizdata)
- var index2 = this.quizdata.content.indexOf('http')
- this.recursion(index2)
- if(!(index2+1)){
- var obj = {
- image: this.quizdata.img_urls
- }
- this.list.push(obj)
- }
-
- this.quizdata.content=this.quizdata.content.replace(/src/g,"none")
- this.quizdata.content=this.quizdata.content.replace(/width/g,"none")
- this.quizdata.content=this.quizdata.content.replace(/height/g,"none")
- this.getParticulars(this.quizdata.lower)
- },
- recursion(index) {//提取图片链接 递归方法
- if (index + 1) {
- var src = this.quizdata.content.slice(index, this.quizdata.content.indexOf('"', index))
- var length = src.length
- var obj = {
- image: src
- }
- this.list.push(obj)
- console.log(src)
- var index3 = this.quizdata.content.indexOf('http', index + length)
- console.log(index3)
- this.recursion(index3)
- }
- }
- },
- onLoad(option) {
- console.log(option.items)
- this.getInvitation(option.items)
- }
- }
- </script>
- <style lang="scss">
- // .u-swiper-wrap {
- // width: 95%;
- // margin: 20rpx auto;
- // }
- .partitlteimg {
- width: 95%;
- margin: 0 auto 20rpx;
- height: 428rpx;
- image {
- max-width: 100%;
- max-height: 100%;
- }
- }
- .quiz {
- width: 95%;
- margin: 20rpx auto;
- border-bottom: 4rpx dashed #E8E8E8;
- .quiz_title{
- width: 100%;
- font-size: 36rpx;
- font-weight: 700;
- text-align: center;
- }
- .quiz_username {
- width: 100%;
- image {
- width: 40rpx;
- height: 40rpx;
- vertical-align: middle;
- margin-right: 20rpx;
- }
- span {
- font-weight: 700;
- font-size: 32rpx;
- }
- }
- .quiz_usertime {
- width: 100%;
- margin-top: 15rpx;
- display: flex;
- justify-content: space-between;
- image {
- width: 50rpx;
- height: 50rpx;
- margin-right: 20rpx;
- border-radius: 50%;
- }
- span {
- font-size: 24rpx;
- color: #C1C1C1;
- font-weight: 700;
- }
- }
- .quiz_usercontert {
- padding: 20rpx;
- margin-bottom: 20rpx;
- overflow: hidden;
- rich-text{
- // display: none;
- color: red;
- image{
- width: 0 !important;
- }
- img{
- width: 0 !important;
- }
- /deep/p{
- color: red;
- }
- /deep/image{
- width: 0 !important;
- height: 0 !important;
- display: none;
- }
- /deep/img{
- width: 0 !important;
- height: 0 !important;
- display: none;
- }
- }
- }
- }
- .comment {
- width: 95%;
- margin: 20rpx auto 0;
- .comment_title {
- font-weight: 700;
- font-size: 32rpx;
- }
- .scroll-view_H {
- height: 600rpx;
- padding-bottom: 100rpx;
- }
- .comment_unit {
- .comment_unit_user {
- display: flex;
- justify-content: space-between;
- margin-top: 20rpx;
- .username {
- display: flex;
- align-items: center;
- image {
- width: 50rpx;
- height: 50rpx;
- margin-right: 20rpx;
- border-radius: 50%;
- }
- p {
- width: 60rpx;
- height: 30rpx;
- color: white;
- background-color: #5CA348;
- font-size: 24rpx;
- text-align: center;
- line-height: 30rpx;
- padding: 0 10rpx;
- margin-left: 20rpx;
- border-radius: 8rpx;
- }
- }
- }
- .comment_unit_con {
- padding-left: 60rpx;
- /deep/p {
- margin-top: 20rpx;
- img {
- margin-top: 20rpx;
- display: block;
- width: 180rpx !important;
- height: 180rpx !important;
- }
- }
- }
- }
- }
- .issue_box {
- width: 100%;
- background-color: #FFFFFF;
- }
- .issue {
- width: 95%;
- margin: 0 auto;
- display: flex;
- padding-bottom: 20rpx;
- input {
- width: 90%;
- background-color: #F3F3F3;
- height: 60rpx;
- text-indent: 1em;
- }
- p {
- width: 10%;
- text-align: right;
- line-height: 60rpx;
- color: #7a7a7a;
- }
- }
- </style>
|