| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="详情"></uni-nav-bar>
- </view>
- <view class="img_box">
- <image :src="$imageURL+'/bigdata_app'+'/image/loading-2.gif'" mode="" class="imgbg"></image>
- <image :src="wormcasedata.img_urls" mode="" class="img" @click="examine(wormcasedata.img_urls)"></image>
- </view>
- <p class="name">{{wormcasedata.name}}</p>
- <view v-for="(item,index) in preventionArr" :key="index" class="prevention">
- <view class="prevention_title">
- <u-icon name="play-right-fill" size="24" color="#55A92D"></u-icon>
- <p>{{regexptitle[index]}}:</p>
- </view>
- <p class="prevention_con">{{item}}</p>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- wormcasedata: {},
- unititle: '',
- wormdata: { //虫子数据
- },
- disease: { //病害数据
- },
- preventionArr: [],
- regexptitle: []
- }
- },
- methods: {
- async getIntroduce(data) {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=pest.pests.pests_info',
- data: {
- pest_id: data
- }
- })
- console.log(res)
- this.wormcasedata = res
- var regex2 = /\[(.+?)\]/g; // [] 中括号
- var str = this.wormcasedata.prevention
- var arr = str.match(regex2)
- var arrindex = []
- for (var i = 0; i < arr.length; i++) {
- arrindex.push(str.indexOf(arr[i]))
- }
- for (var i = 0; i < arr.length; i++) {
- this.preventionArr.push(str.slice(arrindex[i] + arr[i].length, arrindex[i + 1]))
- }
- for (var i = 0; i < arr.length; i++) {
- arr[i] = arr[i].slice(1, arr[i].length - 1)
- }
- this.regexptitle = arr
- },
- clickLeft() {
- // uni.navigateTo({
- // url: "./wormcase?name=" + this.unititle
- // })
- uni.navigateBack({
- delta:1
- })
- },
- examine(url) {
- var imgarr =[]
- imgarr.push(url)
- console.log(imgarr)
- uni.previewImage({
- urls: imgarr
- });
- }
- },
- onLoad(option) {
- console.log(option)
- this.unititle = option.title
- this.getIntroduce(option.id)
- }
- }
- </script>
- <style lang="scss">
- .name {
- font-size: 34rpx;
- font-weight: 700;
- width: 95%;
- margin: 100rpx auto 0;
- }
- .img_box{
- width: 100%;
- height: 320rpx;
- position: relative;
- top: 44px;
- .imgbg{
- width: 30%;
- height: 50%;
- position: absolute;
- top: 25%;
- left: 35%;
- }
- .img{
- width: 100%;
- height: 100%;
- position: absolute;
- }
- }
- .prevention {
- font-size: 28rpx;
- color: #919191;
- width: 95%;
- margin: 20rpx auto;
- .prevention_title {
- display: flex;
- p {
- margin-left: 20rpx;
- color: #000000;
- font-size: 28rpx;
- font-weight: 700;
- }
- }
- .prevention_con {
- padding-left: 6%;
- }
- }
- </style>
|