...
litian
2024-03-21 8b324fc7527762eb7c7590751757b87834cfca00
...
11个文件已修改
4个文件已添加
454 ■■■■ 已修改文件
app.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
assets/js/config.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/components/webView/index.js 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/components/webView/index.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/components/webView/index.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/components/webView/index.wxss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.js 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.wxml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packagePersonal/pages/userSetting/index.wxss 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/index.wxss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/personalCenter/index.js 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/personalCenter/index.wxml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/personalCenter/index.wxss 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json
@@ -1,9 +1,9 @@
{
  "pages": [
    "pages/student/index",
    "pages/home/home",
    "pages/retrievalPage/index",
    "pages/cart/paymentPage/index",
    "pages/student/index",
    "pages/cart/index",
    "pages/bookExhibitionList/index",
    "pages/bookExhibitionDetails/index",
@@ -51,7 +51,8 @@
        "pages/bookServices/list/index",
        "pages/bookServices/detail/index",
        "pages/bookServices/examination/examination",
        "pages/bookServices/webpage/index"
        "pages/bookServices/webpage/index",
        "pages/components/webView/index"
      ]
    }
  ],
assets/js/config.js
@@ -20,7 +20,8 @@
export const fontUrl = "http://192.168.3.132:5173";
// export const fontUrl = "http://182.92.203.7:3007/jsek/website";
// export const fontUrl = "http://jsysf.bnuic.com/website";
// export const epubUrl = "http://182.92.203.7:3007/epubReadMobile/";
export const epubUrl = "http://jsysf.bnuic.com/epubReadMobile/#/";
const config = {
  requestCtx,
@@ -34,6 +35,7 @@
  seminar,
  fontUrl,
  reg_tel,
  reg_telphone
  reg_telphone,
  epubUrl
};
export default config;
packageBookService/pages/bookServices/detail/index.wxss
@@ -202,7 +202,7 @@
.box-bottom {
  position: fixed;
  left: 0;
  bottom: 40rpx;
  bottom: env(safe-area-inset-bottom);
  width: 100%;
  height: 110rpx;
}
packageBookService/pages/components/webView/index.js
New file
@@ -0,0 +1,165 @@
// packageBookService/pages/components/webView/index.js
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    src: "",
    link: false,
    epubObj: null,
    currentPage: '',
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    if (options && options.link) {
      this.setData({
        src: decodeURIComponent(options.link),
        link: options.link ? true : false,
      })
    } else {
      this.setData({
        epubObj: options,
        src: ''
      })
      if (options) {
        wx.setNavigationBarTitle({
          title: options.fileName,
        })
        this.getProgress(options)
      }
    }
  },
  onLoadWeb(e) {
    console.log(e, "load")
  },
  onError(e) {
    console.log(e, "err")
  },
  setWebViewSrc: function (data) {
    var url = app.config.epubUrl +
      "?md5=" +
      data.md5 +
      "&bookName=" +
      data.fileName +
      "&url=" + app.config.requestCtx +
      "&token=" +
      wx.getStorageSync(app.config.tokenKey) +
      "&recordLocation=" +
      this.data.currentPage
    this.setData({
      src: url
    })
  },
  // 获取UserKey
  getProgress: function (dataObj) {
    app.MG.identity
      .getUserKey({
        domain: "bookReadProgress",
        keys: [this.data.epubObj.md5],
      })
      .then((res) => {
        if (res.length) {
          try {
            this.setData({
              currentPage: JSON.parse(res[0].value).page,
            });
          } catch (error) {
            this.setData({
              currentPage: "",
            });
          }
          if (this.data.currentPage > this.data.probationPage) {
            this.setData({
              currentPage: "",
            });
          }
        }
        this.setWebViewSrc(dataObj);
      });
  },
  // 设置userKey
  setProgress: function (data) {
    if (data.page && data.page != this.data.currentPage) {
      app.MG.identity
        .setUserKey({
          setKeyRequests: [{
            domain: "bookReadProgress",
            key: this.data.epubObj.md5,
            value: JSON.stringify(data),
          },],
        })
        .then((res) => { });
    }
  },
  drawBack(e) {
    let {
      currentLocation,
      percentage,
      type
    } =
      e.detail.data[0];
    if (type == "progress" && type != "backDetail") {
      this.setProgress({
        page: currentLocation,
        progress: percentage,
      });
    } else if (type == "backDetail") {
      this.setProgress({
        page: 1,
        progress: "0%",
      });
    }
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
  },
})
packageBookService/pages/components/webView/index.json
New file
@@ -0,0 +1,4 @@
{
  "navigationBarTitleText": "京师E课",
  "usingComponents": {}
}
packageBookService/pages/components/webView/index.wxml
New file
@@ -0,0 +1,4 @@
<!--packageBookService/pages/components/webView/index.wxml-->
<view class="page-body">
  <web-view bind:message="drawBack" binderror="onError" bindload="onLoadWeb" src="{{src}}"></web-view>
</view>
packageBookService/pages/components/webView/index.wxss
New file
@@ -0,0 +1,6 @@
/* packageBookService/pages/components/webView/index.wxss */
.page-body {
  width: 100vw;
  height: calc(100vh - env(safe-area-inset-bottom));
  overflow: hidden;
}
packagePersonal/pages/userSetting/index.js
@@ -1,18 +1,22 @@
// packagePersonal/pages/userSetting/index.js
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {},
    defaultAvatarUrl: 'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png',
    visible: false
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
  onLoad() {
    if (wx.getStorageSync(app.config.tokenKey)) {
      this.getUserInfo()
    }
  },
  /**
@@ -28,19 +32,52 @@
  onShow() {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  // 获取登录用户身份
  getUserInfo() {
    app.MG.identity.getCurrentAppUser().then(res => {
      // 用户信息优先级:教师认证 > 微信 > 学生(注册时默认)
      if (res) {
        let defaultUser = {};
        let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher')
        let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo')
        let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword')
        let WeChatInfo = res.infoList.find((item) => item.type === "WeChat");
        let phoneInfo = res.secretList.find((item) => item.type == 'MobilePhone')
        let emailInfo = res.secretList.find((item) => item.type == 'EMail')
        if (teacherRole && teacherInfos) {
          defaultUser = {
            ...teacherInfos,
            fullName: teacherInfos.fullName,
            icon: teacherInfos.icon,
            userId: res.userId,
            role: 'Teacher',
            roleId: teacherRole.role.id,
            phoneNumber: phoneInfo?.credential,
            Email: emailInfo ? emailInfo.credential : JSON.parse(teacherInfos.data).email
          }
        } else if (WeChatInfo) {
          defaultUser = {
            ...WeChatInfo,
            fullName: WeChatInfo.name,
            icon: WeChatInfo.icon,
            userId: res.userId,
            phoneNumber: phoneInfo?.credential,
            Email: emailInfo?.credential
          }
        } else if (secretData) {
          defaultUser = {
            fullName: secretData.credential,
            icon: "",
            userId: res.userId,
            phoneNumber: phoneInfo?.credential,
            Email: emailInfo?.credential
          }
        }
        this.setData({
          userInfo: defaultUser
        })
      }
    });
  },
  /**
packagePersonal/pages/userSetting/index.json
@@ -1,3 +1,7 @@
{
  "usingComponents": {}
  "navigationBarTitleText": "设置",
  "usingComponents": {
    "t-icon": "tdesign-miniprogram/icon/icon",
    "t-avatar": "tdesign-miniprogram/avatar/avatar"
  }
}
packagePersonal/pages/userSetting/index.wxml
@@ -1,2 +1,40 @@
<!--packagePersonal/pages/userSetting/index.wxml-->
<text>packagePersonal/pages/userSetting/index.wxml</text>
<view class="container">
  <view class="itemList">
    <view class="label">头像</view>
    <view class="contentImg">
      <t-avatar image="{{defaultAvatarUrl}}" class="user-center-card__header__avatar" />
    </view>
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
  </view>
  <view class="itemList">
    <view class="label">用户名</view>
    <view class="content">{{userInfo.fullName || '微信用户'}}</view>
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
  </view>
  <view class="itemList">
    <view class="label">手机号码</view>
    <view class="content">{{userInfo.phoneNumber || '未绑定手机号'}}</view>
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
  </view>
  <view class="itemList">
    <view class="label">邮箱</view>
    <view class="content">{{userInfo.Email}}</view>
    <t-icon name="chevron-right" size="40rpx" color="#C2C2C2" />
  </view>
</view>
<t-popup visible="{{visible}}" bind:visible-change="onVisibleChange" placement="bottom">
  <view class="block">
    <view class="header">
      <view class="title">请选择您的用户类型</view>
    </view>
    <view class="body">
      <view wx:for="{{userTypeList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-info="{{item}}" bindtap="tabUserTypeClick" class="{{item.value === userTypeActive ? 'activeItem item' : 'item'}}">
        {{ item.lable }}
      </view>
    </view>
    <view class="footer">
      <button class="submit" bindtap="submit">确定</button>
    </view>
  </view>
</t-popup>
packagePersonal/pages/userSetting/index.wxss
@@ -1 +1,37 @@
/* packagePersonal/pages/userSetting/index.wxss */
.container {
  padding: 20rpx 0;
}
.itemList {
  border-bottom: 2rpx solid #E9E9E9;
  padding: 30rpx;
  display: flex;
  /* height: 120rpx; */
  align-items: center;
  justify-content: space-between !important;
}
.label {
  font-weight: bold;
  width: 180rpx;
}
.contentImg {
  height: 120rpx;
  width: 120rpx;
  flex: 1;
  text-align: right;
  margin-right: 20rpx;
}
.user-center-card__header__avatar {
  width: 120rpx;
  height: 120rpx;
  border-radius: 48rpx;
  overflow: hidden;
}
.content {
  flex: 1;
  color: #5C5C5C;
}
pages/cart/index.wxss
@@ -33,14 +33,12 @@
}
.bottomBox {
  background-color: #0052d9;
  position: fixed;
  bottom: 0;
  /* bottom: 0; */
  left: 0;
  right: 0;
  padding-bottom: 53px;
  height: 112rpx;
  bottom: calc(env(safe-area-inset-bottom) + 112rpx);
  height: 120rpx;
  background: #FFFFFF;
  box-shadow: 0rpx -2rpx 0rpx 2rpx rgba(0, 0, 0, 0.08);
  display: flex;
pages/personalCenter/index.js
@@ -167,7 +167,9 @@
        let userTypeData = res.infoList.find((item) => item.type == 'userType')
        let type = "";
        if (userTypeData) {
          this.data.userTypeActive = JSON.parse(userTypeData.data).userType;
          this.setData({
            userTypeActive: JSON.parse(userTypeData.data).userType,
          });
          type = userTypeList.find((item) => item.value === this.data.userTypeActive)?.lable;
        } else {
          type = '-'
@@ -250,7 +252,6 @@
  },
  //修改用户类型
  editUserType() {
    console.log(44)
    if (!this.data.visible) {
      this.setData({
        visible: true,
@@ -261,6 +262,37 @@
    this.setData({
      visible: e.detail.visible,
    });
  },
  tabUserTypeClick(e) {
    console.log(e)
    let { info } = e.currentTarget.dataset;
    this.setData({
      userTypeActive: info.value,
    });
  },
  submit() {
    let userTypeInfo = {
      requests: [
        {
          data: JSON.stringify({ userType: this.data.userTypeActive }),
          name: '用户类型',
          type: 'userType'
        }
      ]
    }
    app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => {
      if (res) {
        wx.showToast({
          title: "修改成功",
          icon: 'success',
          duration: 1000,
        })
        this.getUserInfo()
        this.setData({
          visible: false,
        });
      }
    })
  },
  //设置
  gotoUserEditPage() {
@@ -292,8 +324,4 @@
  onShareAppMessage() {
  },
  //跳转关于我们和联系我们
  onAboutUS() {
    console.log(111);
  }
})
pages/personalCenter/index.wxml
@@ -33,7 +33,7 @@
      <view class="domainList">
        <view wx:for="{{menuData}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toPages" data-info="{{item}}" class="listItem">
          <view class="icon">
            <t-image src="{{item.icon}}" mode="heightFix" class="img" />
            <image src="{{item.icon}}" mode="aspectFit" class="img" />
          </view>
          <view class="label">
            <text>{{item.title}}</text>
@@ -48,7 +48,7 @@
      <view class="domainList1">
        <view wx:for="{{moreMenu}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toPages" data-info="{{item}}" class="listItem">
          <view class="icon">
            <t-image src="{{item.icon}}" mode="heightFix" class="img" />
            <image src="{{item.icon}}" mode="aspectFit" class="img" />
          </view>
          <view class="label">
            <text>{{item.title}}</text>
@@ -58,7 +58,7 @@
      <view class="domainList2">
        <view wx:for="{{moreMenu1}}" wx:for-item="item" wx:for-index="index" wx:key="index" bindtap="toPages" data-info="{{item}}" class="listItem">
          <view class="icon">
            <t-image src="{{item.icon}}" mode="heightFix" class="img" />
            <image src="{{item.icon}}" mode="aspectFit" class="img" />
          </view>
          <view class="label">
            <text>{{item.title}}</text>
@@ -73,12 +73,13 @@
        <view class="title">请选择您的用户类型</view>
      </view>
      <view class="body">
        <view wx:for="{{userTypeList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-info="{{item}}" bindtap="tabUserTypeClick" :class="item.value == userTypeActive ? 'activeItem item hover' : 'item hover'">
        <view wx:for="{{userTypeList}}" wx:for-item="item" wx:for-index="index" wx:key="index" data-info="{{item}}" bindtap="tabUserTypeClick" class="{{item.value === userTypeActive ? 'activeItem item' : 'item'}}">
          {{ item.lable }}
        </view>
      </view>
      <view class="footer">
        <button class="submit" bindtap="submit">提交</button>
        <button class="submit" bindtap="submit">确定</button>
      </view>
    </view>
  </t-popup>
pages/personalCenter/index.wxss
@@ -122,12 +122,14 @@
  width: 46rpx;
  height: 46rpx;
  margin: 0 auto;
  display: flex;
}
.listItem .icon .t-image {
  width: 100%;
.listItem .icon .img {
  /* width: 100%; */
  height: 100%;
  object-fit: contain;
}
.listItem .label {
@@ -140,21 +142,53 @@
.block {
  width: 100vw;
  height: 240px;
  background: #fff;
  border-top-left-radius: 16rpx;
  border-top-right-radius: 16rpx;
}
.header {
.block .header {
  display: flex;
  align-items: center;
  height: 116rpx;
}
.title {
.block .title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 36rpx;
}
.block .body {
  padding: 0 20rpx;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.item {
  width: calc(100%/2 - 30rpx);
  text-align: center;
  padding: 30rpx 0;
  margin: 0 10rpx 20rpx 10rpx;
  background: #F9F9F9;
  border: 4rpx solid #F9F9F9;
  border-radius: 10rpx;
}
.activeItem {
  border: 4rpx solid #ff6c00;
  background: #fff;
}
.footer {
  width: 80%;
  margin: 10rpx auto;
}
.submit {
  background: #ff6c00;
  color: #fff;
  border-radius: 50rpx;
}