Parcourir la source

修改 研学试题bug

wenjie il y a 9 mois
Parent
commit
fefa964db6

BIN
dist.zip


+ 1 - 1
src/utils/config.js

@@ -2,7 +2,7 @@
  * @Author: wj 1454560336@qq.com
  * @Date: 2024-01-05 16:08:18
  * @LastEditors: wenjie 1454560336@qq.com
- * @LastEditTime: 2024-08-13 10:29:33
+ * @LastEditTime: 2024-08-21 09:31:33
  * @FilePath: \admin-manage\src\utils\config.js
  * @Description: 124234
  * 

+ 41 - 0
src/utils/guid.js

@@ -0,0 +1,41 @@
+/**
+ * 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
+ * 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier) 
+ * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
+ * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
+ * v-for的时候,推荐使用后端返回的id而不是循环的index
+ * @param {Number} len uuid的长度
+ * @param {Boolean} firstU 将返回的首字母置为"u"
+ * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
+ */
+function guid(len = 32, firstU = true, radix = null) {
+	let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
+	let uuid = [];
+	radix = radix || chars.length;
+
+	if (len) {
+		// 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
+		for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
+	} else {
+		let r;
+		// rfc4122标准要求返回的uuid中,某些位为固定的字符
+		uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
+		uuid[14] = '4';
+
+		for (let i = 0; i < 36; i++) {
+			if (!uuid[i]) {
+				r = 0 | Math.random() * 16;
+				uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
+			}
+		}
+	}
+	// 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
+	if (firstU) {
+		uuid.shift();
+		return 'zs' + uuid.join('');
+	} else {
+		return uuid.join('');
+	}
+}
+
+export default guid;

+ 5 - 0
src/views/operationManage/activityManage/addActivity.vue

@@ -313,6 +313,7 @@ export default Vue.extend({
   },
   computed: {
     rules() {
+
       if(this.setQuery.activityType == 1){
         return  {
           activityName: [
@@ -341,6 +342,9 @@ export default Vue.extend({
            signupEndTime: [
             { required: true, message: "请选择报名时间", trigger: "change" },
           ],
+          address: [
+            { required: true, message: "请输入活动地址", trigger: "blur" },
+          ],
           //  limited: [
           //   { required: true, message: "请输入报名人数", trigger: "blur" },
           //   { type:'number',min:1, message: "报名人数不能小于1", trigger: "blur" },
@@ -425,6 +429,7 @@ export default Vue.extend({
         this.limited = 1
         this.date1 = ''
       }
+   
     }
   },
   methods: {

+ 2 - 1
src/views/operationManage/couponManage/index.vue

@@ -58,7 +58,8 @@
          <el-date-picker
           v-model="date"
           size="small"
-          value-format="timestamp"
+          :default-time="['00:00:00', '23:59:59']"
+          value-format="yyyy-MM-dd HH:mm:ss"
           class="item-width-350 ml10"
           type="datetimerange"
           range-separator="至"

+ 25 - 19
src/views/operationManage/goodsManage/homeGoodsSet.vue

@@ -129,7 +129,7 @@
           <!-- <el-button type="text" size="small" @click="handleEdit(scope.row)"
             >编辑</el-button
           > -->
-          <el-button type="text" size="small" @click="handleDel(scope.row.pid,true)"
+          <el-button type="text" size="small" @click="handleDel(scope.row,true)"
             >加入黑名单</el-button
           >
         </template>
@@ -174,15 +174,17 @@
           show-overflow-tooltip
         >
         <template slot-scope="scope">
-          <el-imageproductType
-          v-if="scope.row.cover.length"
-          :src="scope.row.cover[0]"
-            class="small-img"
-            style="width: 40px; height: 40px;"
-            fit="cover"
-            >
-            </el-imageproductType>
-            <span class="ml10">{{scope.row.title}}</span>
+           <div class="info">
+        <el-image
+        v-if="scope.row.cover&&scope.row.cover.length"
+        :src="scope.row.cover[0]"
+          class="small-img"
+          style="width: 40px; height: 40px;"
+          fit="cover"
+          >
+          </el-image>
+          <span class="ml10">{{scope.row.title}}</span>
+        </div>
         </template>
         </el-table-column>
         <el-table-column
@@ -232,7 +234,7 @@
             <!-- <el-button type="text" size="small" @click="handleEdit(scope.row)"
               >编辑</el-button
             > -->
-            <el-button type="text" size="small" @click="handleDel(scope.row.pid,false)"
+            <el-button type="text" size="small" @click="handleDel(scope.row,false)"
               >移除黑名单</el-button
             >
           </template>
@@ -419,10 +421,14 @@ export default {
   },
   methods: {
     handleSelectionChange(val){
-      this.pids = val.map(item => item.pid)
+      this.pids = val.map(item => {
+        return { pid:item.pid,regionCode:item.regionCode}
+      })
     },
     handleSelectionChange1(val){
-      this.pids1 = val.map(item => item.pid)
+      this.pids1 = val.map(item => {
+         return { pid:item.pid,regionCode:item.regionCode}
+      })
     },
     handleList(){
       this.dialogFormVisible3 = true
@@ -474,7 +480,7 @@ export default {
       this.topFrom.regionCode = row.regionCode
     },
     // 删除
-     handleDel(id,hidden) {
+     handleDel(item,hidden) {
       let str = ''
       if(hidden){
         str = '拉黑'
@@ -486,7 +492,7 @@ export default {
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          setHidden({pids:[id],hidden}).then(res=>{
+          setHidden({products:[{pid:item.pid,regionCode:item.regionCode}],hidden}).then(res=>{
             if(res.state == 'Success'){
                this.$notify({
                 title: '成功',
@@ -505,20 +511,20 @@ export default {
     },
     handleBatch(hidden){
       let str = ''
-      let pids
+      let products
       if(hidden){
         str = '拉黑'
-        pids = this.pids
+        products = this.pids
       }else{
         str = '取消拉黑'
-        pids = this.pids1
+        products = this.pids1
       }
        this.$confirm(`此操作将批量${str}该数据, 是否继续?`, '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          setHidden({pids,hidden}).then(res=>{
+          setHidden({products,hidden}).then(res=>{
             if(res.state == 'Success'){
               this.dialogFormVisible3 = false
               this.pids = []

+ 82 - 13
src/views/operationManage/goodsManage/productLibrary.vue

@@ -21,9 +21,9 @@
         搜索
       </el-button>
       </div>
-       <!-- <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
+       <el-button class="add-btn" type="primary" size="small" @click="handleAdd"
         >添加</el-button
-      > -->
+      >
     
     </div>
 
@@ -124,15 +124,15 @@
     <el-form label-width="130px" :model="setQuery"
       ref="setQuery"
       :rules="rules">
-        <el-form-item label="产品类型">
+        <el-form-item label="产品类型" prop="productType">
           <el-select
               v-model="setQuery.productType"
               class="item-width-300"
               placeholder="请选择产品类型"
-              disabled
+              :disabled="title == '编辑'"
             >
               <el-option
-                v-for="item in typeOptions"
+                v-for="item in options"
                 :key="item.value"
                 :label="item.label"
                 :value="item.value"
@@ -140,7 +140,7 @@
               </el-option>
             </el-select>
         </el-form-item>
-          <el-form-item label="产品图片:" prop="logoPath">
+          <el-form-item label="产品图片:" prop="cover">
           <Upload
             type="logoPath"
             id="logoPath"
@@ -156,12 +156,36 @@
             v-model="setQuery.title"
             class="item-width-300"
             ></el-input>
+        </el-form-item>
+        <el-form-item label="跳转地址" v-if="setQuery.productType == 'Web'"  prop="meta.url">
+            <el-input
+            v-model="setQuery.meta.url"
+            class="item-width-300"
+            ></el-input>
+        </el-form-item>
+        <el-form-item label="地址" >
+            <el-input
+            v-model="setQuery.address"
+            class="item-width-300"
+            ></el-input>
         </el-form-item>
          <el-form-item label="邮政编码"  prop="regionCode">
             <el-input
             v-model.number="setQuery.regionCode"
             class="item-width-300"
             ></el-input>
+        </el-form-item>
+         <el-form-item label="经度" >
+            <el-input
+            v-model.number="setQuery.locationPoint.longitude"
+            class="item-width-300"
+            ></el-input>
+        </el-form-item>
+         <el-form-item label="纬度">
+            <el-input
+            v-model.number="setQuery.locationPoint.latitude"
+            class="item-width-300"
+            ></el-input>
         </el-form-item>
          <el-form-item label="售价" >
             <el-input
@@ -202,6 +226,7 @@
   <script>
 import { debounce } from "@/utils/index";
 import { goodsStoreList,setHidden,listAllTypes,upsertProduct} from "@/api/goods";
+import guid from "@/utils/guid";
 import Upload from "@/components/Upload";
 
 export default {
@@ -230,7 +255,6 @@ export default {
       setQuery1:{
         type:''
       },
-      options:[],
       setQuery:{
        cover:[],
        productType:'',
@@ -239,6 +263,11 @@ export default {
        salePrice:0,
        originalPrice:0,
        hotCount:0,
+       address:'',
+       locationPoint:{
+          longitude: 0,
+          latitude: 0
+        }
       },
       topFrom:{
         pid:"",
@@ -248,9 +277,10 @@ export default {
       tabList:[],
       rules:{
          productType: [{ required: true, message: "请选择产品类型", trigger: "change" }],
+         cover: [{ required: true, message: "请上传产品图片", trigger: "change" }],
          regionCode: [{ required: true, message: "请输入邮政编码", trigger: "blur" }],
          title: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
-        //  title: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
+         'meta.url': [{ required: true, message: "请输入跳转链接", trigger: "blur" }],
          
       },
       rules1:{
@@ -302,6 +332,23 @@ export default {
       }
     };
   },
+  computed: {
+    options() {
+      if(this.title == '添加'){
+        return [{
+          value:"Web",
+          label:"Web链接"
+        }]
+      }else{
+        return this.typeOptions
+
+      }
+      
+        
+      
+      return this.data 
+    }
+  },
   methods: {
     // 图片统一上传
     uploadEnd(val) {
@@ -335,17 +382,39 @@ export default {
         originalPrice: row.originalPrice,
         salePrice: row.salePrice,
         hotCount: row.hotCount,
+        address: row.address,
+        locationPoint:row.locationPoint ||{
+          longitude: 0,
+          latitude: 0
+        }
+      }
+      if(row.productType == 'Web'){
+        this.setQuery.meta = row.meta
       }
     },
     handleAdd() {
         this.title = '添加'
       this.dialogFormVisible = true
       this.setQuery = {
-        "activityContent": "",
-        "activityId": "",
-        "activityMoney": 0,
-        "endTime": "",
-        "startTime": ""
+        cover: [],
+        productType: '',
+        regionCode: '',
+        title: '',
+        pid: guid(),
+        meta: {
+          url: '',
+        },
+        top: 0,
+        hidden: false,
+        salesCount: 0,
+        originalPrice: 0,
+        salePrice: 0,
+        hotCount: 0,
+        address:'',
+        locationPoint:{
+          longitude: 0,
+          latitude: 0
+        }
       }
     },
 

+ 1 - 1
src/views/operationManage/marketingManage/index.vue

@@ -64,7 +64,7 @@
        <el-table-column
         align="center"
         label="创建时间"
-        prop="communityName"
+        prop="createTime"
         show-overflow-tooltip
       >
       </el-table-column>

+ 1 - 1
src/views/studyManage/questionBankManage/editQuestions.vue

@@ -232,7 +232,7 @@ export default {
         };
     },
     getAllColumn() {
-      getAllColumn().then((res) => {
+      getAllColumn({belongType:2}).then((res) => {
         if (res.state == "Success") {
           res.content.map((item) => {
             this.options.push({