shish 2 lat temu
rodzic
commit
1183d179b8
2 zmienionych plików z 49 dodań i 5 usunięć
  1. 45 5
      ghsApp/src/admin/notice/index.vue
  2. 4 0
      ghsApp/src/api/notice/index.js

+ 45 - 5
ghsApp/src/admin/notice/index.vue

@@ -20,6 +20,7 @@
                                 <text style="float:right;font-weight:normal;font-size:26upx;">{{ item.addTime ? item.addTime.substr(5,11):'' }}</text>
                             </view>
                             <view class="info-name">{{ item.content }}</view>
+                            <button @click.stop="changeClass(item)" v-if="item.type == 1" class="admin-button-com middle blue" style="position:absolute;top:100upx;right:-4upx;">修改分类</button>
                         </view>
                     </view>
                 </block>
@@ -28,13 +29,26 @@
                 </block>
             </view>
         </view>
+
+		<uni-popup ref="classRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
+            <view style="margin-left:30upx;margin-top:15upx;font-size:24upx;font-weight:bold;">请选择分类:</view>
+			<view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
+				<view v-for="(item, index) in itemClassList" :key="index" @tap.stop="setThisClass(item)" style="margin-bottom:20upx;margin-left:3upx;">
+				<image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
+				<view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
+				</view>
+			</view>
+		</uni-popup>
+
     </view>
 </template>
 <script>
 import Tabs from "@/components/plugin/tabs";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { list } from "@/mixins";
-import { getNotifyList,allReadNotify } from "@/api/notice";
+import { getNotifyList,allReadNotify,setRead } from "@/api/notice";
+import { getAllItemClass } from "@/api/item-class";
+import { batchModifyClass } from "@/api/product";
 export default {
     name: "index",
     components: { Tabs, AppWrapperEmpty },
@@ -42,6 +56,7 @@ export default {
     data() {
         return {
             tabIndex: 0,
+            itemClassList:[],
             tabs: [
                 {
                     name: "全部",
@@ -58,7 +73,9 @@ export default {
                     key: 1,
                     value: 0
                 }
-            ]
+            ],
+            currentItemId:0,
+            currentNotify:{}
         };
     },
     onPullDownRefresh() {
@@ -81,6 +98,25 @@ export default {
         this.getNoticeList()
     },
     methods: {
+        setThisClass(info){
+            this.$refs.classRef.close()
+            let that = this
+            batchModifyClass({ids:JSON.stringify([that.currentItemId]),classId:info.id}).then(res=>{
+                if(res.code == 1){
+                    setRead({id:that.currentNotify.id}).then(res=>{
+                        if(res.code == 1){
+                            that.currentNotify.read = 1
+                            that.$msg('修改成功')
+                        }
+                    })
+                }
+            })
+        },
+        changeClass(item){
+            this.currentItemId = item.targetId || 0
+            this.currentNotify = item
+            this.$refs.classRef.open('center')
+        },
         allRead(){
             let that = this
             this.$util.confirmModal({content:'确认全部标记?'},() => {
@@ -95,6 +131,9 @@ export default {
         },
         init() {
             this.getNoticeList()
+            getAllItemClass().then(res => {
+                this.itemClassList = res.data
+            })
         },
         getNoticeList() {
             return getNotifyList({read:this.tabs[this.tabIndex].key,page: this.list.page}).then(res => {
@@ -137,6 +176,7 @@ export default {
         position: fixed;
         color:white;
         right:15upx;
+        z-index:9999;
     }
     .allot-list {
         margin-top: 20upx;
@@ -144,15 +184,15 @@ export default {
         padding-bottom:100upx;
         .allot-item {
             margin-bottom: 1upx;
-            padding: 30upx;
+            padding: 30upx 30upx 60upx 30upx;
             display: flex;
             align-items: center;
-
             box-shadow: 0upx 1upx 0upx 0upx #eeeeee;
             background-color: #fff;
             .info {
                 flex: 1;
                 margin-right: 20upx;
+                position:relative;
                 .info-order {
                     font-size: 32upx;
                     font-weight: 600;
@@ -165,7 +205,7 @@ export default {
                 }
                 .info-name {
                     margin: 20upx 0 20upx;
-                    font-size: 28upx;
+                    font-size: 27upx;
                     font-weight: 400;
                     color: #666666;
                 }

+ 4 - 0
ghsApp/src/api/notice/index.js

@@ -1,5 +1,9 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
+export const setRead = data => {
+	return https.get('/notify/set-read', data)
+}
+
 export const allReadNotify = data => {
 	return https.get('/notify/all-read', data)
 }