|
|
@@ -7,21 +7,19 @@
|
|
|
<div class="module-com input-line-wrap goods-wrap">
|
|
|
<div class="module-tit">
|
|
|
<span>选择图片</span>
|
|
|
- <span class="app-color-3">(每次选一张)</span>
|
|
|
+ <span class="app-color-3">(每次最多可选9张)</span>
|
|
|
</div>
|
|
|
<div class="module-det">
|
|
|
- <app-uploader ref="appUploader" @chooseImage="uploadXjImg" :imgList.sync="form.cover" :prefixShow="true" :compress="true" :num="50" />
|
|
|
+ <htz-image-upload :max="9" :compress="true" v-model="xjImgData" :headers="headers"
|
|
|
+ @uploadSuccess="imgUploadSuccess" :quality="60" @imgDelete="imgDeleteFn" :action="getLoginInfo.imgUploadApi">
|
|
|
+ </htz-image-upload>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<view style="text-align:center;">
|
|
|
-
|
|
|
<button class="admin-button-com big blue" style="width:95%;" formType="submit">全部提交</button>
|
|
|
-
|
|
|
</view>
|
|
|
-
|
|
|
- </div>
|
|
|
- </form>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
</view>
|
|
|
|
|
|
<view style="text-align:center;border-top:1upx dashed #cccccc;padding-top:30upx;padding-bottom:30upx;">
|
|
|
@@ -45,7 +43,7 @@
|
|
|
<view class="open-bx warn" @tap.stop.prevent>
|
|
|
<text v-if="xjItem.status == 2" style="color:#777777;">已停用</text>
|
|
|
<text v-else style="color:green;">已启用</text>
|
|
|
- <switch :checked="xjItem.status == 2 ? false : true" @change="changeFn($event,xjItem.id)" style="transform: scale(0.8,0.8)" />
|
|
|
+ <switch :checked="xjItem.status == 2 ? false : true" @change="changeXjStatusFn($event,xjItem.id)" style="transform: scale(0.8,0.8)" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -60,14 +58,16 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
-import AppUploader from "@/components/app-uploader";
|
|
|
-import { mapGetters } from "vuex";
|
|
|
+import AppWrapperEmpty from "@/components/app-wrapper-empty"
|
|
|
+import { mapGetters } from "vuex"
|
|
|
import { getFilterXj,ReplaceXj,clearAll,batchAdd } from "@/api/product/xj"
|
|
|
+//图片上传插件来源:https://ext.dcloud.net.cn/plugin?id=2922 已改造,不能再升级 shish 20211228
|
|
|
+import htzImageUpload from './components/htz-image-upload/htz-image-upload.vue'
|
|
|
export default {
|
|
|
name: "xj",
|
|
|
components: {
|
|
|
- AppWrapperEmpty,AppUploader
|
|
|
+ AppWrapperEmpty,
|
|
|
+ htzImageUpload
|
|
|
},
|
|
|
mixins: [],
|
|
|
data() {
|
|
|
@@ -76,7 +76,9 @@ export default {
|
|
|
xjList:[],
|
|
|
xjData:[],
|
|
|
numList:[],
|
|
|
- uploadXj:[]
|
|
|
+ uploadXjImg:[],
|
|
|
+ xjImgData:[],
|
|
|
+ headers:{token:''}
|
|
|
};
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -91,6 +93,9 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ const token = uni.getStorageSync('token')
|
|
|
+ this.headers.token = token
|
|
|
+
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
},
|
|
|
@@ -126,7 +131,7 @@ export default {
|
|
|
urls: [url]
|
|
|
})
|
|
|
},
|
|
|
- changeFn(e,id){
|
|
|
+ changeXjStatusFn(e,id){
|
|
|
let act = e.target.value == true ? 'start' : 'stop'
|
|
|
let that = this
|
|
|
ReplaceXj({act,id}).then(res=>{
|
|
|
@@ -144,21 +149,31 @@ export default {
|
|
|
this.xjList = res.data.list
|
|
|
});
|
|
|
},
|
|
|
- uploadXjImg(arr) {
|
|
|
- this.uploadXj = arr
|
|
|
+ imgUploadSuccess(res) {
|
|
|
+ var _res = JSON.parse(res.data)
|
|
|
+ if(_res.code == 1){
|
|
|
+ this.xjImgData.push(_res.data.smallUrl)
|
|
|
+ this.uploadXjImg.push(_res.data.shortUrl)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ imgDeleteFn(res){
|
|
|
+ const index = res.index
|
|
|
+ this.uploadXjImg.splice(index,1)
|
|
|
},
|
|
|
// 表单验证
|
|
|
formSubmit(e) {
|
|
|
let that = this
|
|
|
- if (that.$util.isEmpty(this.uploadXj)){
|
|
|
+ if (that.$util.isEmpty(this.uploadXjImg)){
|
|
|
that.$msg('请选择图片')
|
|
|
return false
|
|
|
}
|
|
|
- let imgData = JSON.stringify(this.uploadXj)
|
|
|
+ let imgData = JSON.stringify(this.uploadXjImg)
|
|
|
batchAdd({xjData:imgData}).then(res=>{
|
|
|
that.$msg(res.msg)
|
|
|
if(res.code == 1){
|
|
|
- that.$util.pageTo({url: "/admin/item/xjSelect",type: 3})
|
|
|
+ that.initXj()
|
|
|
+ this.xjImgData = [];
|
|
|
+ this.uploadXjImg = []
|
|
|
}
|
|
|
})
|
|
|
}
|