Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

setting.vue 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view v-if="source=='WECHAT'">
  3. <template v-for="(col,index) in list" :key="index">
  4. <view class="title">{{col.title}}</view>
  5. <u-cell-group>
  6. <u-cell-item :title="item.title" v-for="(item,i) in col.columns" :key="i" @click="itemClick(item)"
  7. :titleStyle="titleStyle" borderBottom></u-cell-item>
  8. </u-cell-group>
  9. </template>
  10. </view>
  11. <view v-else>
  12. <template v-for="(col,index) in listALI" :key="index">
  13. <view class="title">{{col.title}}</view>
  14. <u-cell-group>
  15. <u-cell-item :title="item.title" v-for="(item,i) in col.columns" :key="i" @click="itemClick(item)"
  16. :titleStyle="titleStyle" borderBottom></u-cell-item>
  17. </u-cell-group>
  18. </template>
  19. </view>
  20. <button class="action" @click="loginOut">退出登录</button>
  21. </template>
  22. <script setup lang="ts">
  23. import { source } from "@/utils/network/difference";
  24. import { useUserStore } from '@/stores/user';
  25. import { msg, navTo } from '@/utils/utils';
  26. const userStore = useUserStore();
  27. const { loginOut } = userStore;
  28. import {
  29. request
  30. } from "@/utils/network/request.js";
  31. import {
  32. infoQuery, envs
  33. } from "@/utils/network/api.js";
  34. import {
  35. stringToJson
  36. } from "@/utils/network/encryption.js";
  37. const titleStyle = { fontSize: '28rpx', color: '#333333' };
  38. const basePath = "/subpackage/personal-center/setting/";
  39. const list = [
  40. {
  41. title: '个人信息管理',
  42. columns: [
  43. { title: '个人信息更正', path: 'personal-information/corrections', login: true },
  44. { title: '个人信息删除', path: 'information-deletion', login: true },
  45. { title: '权限管理', path: 'permission-management', login: true },
  46. // {title:'撤销权限管理',path:'revoke-permission',login:true}, //无 UI
  47. { title: '信息副本导出', path: 'info-export', login: true }, //无 UI
  48. { title: '注销账户', path: 'account-cancellation', login: true },
  49. { title: '车辆信息管理', path: '/subpackage/personal-center/vehicle-information', login: true }, //无 UI
  50. { title: '收货地址管理', path: 'addressManager', login: true }, //有 UI 无界面
  51. // {title:'银行卡',path:'bank-card/bank-card',login:true},//有 UI 无界面
  52. ]
  53. },
  54. {
  55. title: '隐私',
  56. columns: [
  57. { title: '用户协议', path: 'user-agreement', login: true },//无 UI
  58. { title: '隐私政策', path: 'conceal-agreement', login: true },//无 UI
  59. { title: '风险提示告知书', path: 'risk-agreement', login: true },//无 UI
  60. { title: '个人信息收集清单', path: 'info_connect', login: true },//无 UI
  61. { title: '权限使用说明', path: 'usage-instructions', login: true }//无 UI
  62. ]
  63. },
  64. ]
  65. const listALI = [
  66. {
  67. title: '个人信息管理',
  68. columns: [
  69. { title: '收货地址管理', path: 'addressManager', login: true }, //有 UI 无界面
  70. // {title:'银行卡',path:'bank-card/bank-card',login:true},//有 UI 无界面
  71. ]
  72. },
  73. {
  74. title: '隐私',
  75. columns: [
  76. { title: '用户协议', path: 'user-agreement', login: true },//无 UI
  77. { title: '隐私政策', path: 'conceal-agreement', login: true },//无 UI
  78. { title: '风险提示告知书', path: 'risk-agreement', login: true },//无 UI
  79. { title: '个人信息收集清单', path: 'info_connect', login: true },//无 UI
  80. { title: '权限使用说明', path: 'usage-instructions', login: true }//无 UI
  81. ]
  82. },
  83. ]
  84. /* item点击 */
  85. const itemClick = (item) => {
  86. console.log("item", item)
  87. if (!item.path) {
  88. msg('找不到该界面哦!');
  89. return;
  90. }
  91. if (item.title == '车辆信息管理') {
  92. navTo(item.path, item.login);
  93. } else if (item.title == '用户协议' || item.title == '隐私政策' || item.title == '风险提示告知书' || item.title == '权限使用说明') {
  94. let type = ""
  95. if (item.title == '用户协议') {
  96. type = "USER_AGREEMENT"
  97. } else if (item.title == '隐私政策') {
  98. type = "PRIVACY_POLICY"
  99. } else if (item.title == '风险提示告知书') {
  100. type = "RISK_NOTIFICATION"
  101. } else if (item.title == '权限使用说明') {
  102. type = "PRIVILEGE_USE"
  103. }
  104. getInfo(type).then((data) => {
  105. console.log("data", data)
  106. if (data.textType == "URL") {
  107. previewPdf(envs[process.env.NODE_ENV].baseUrl + data.text)
  108. } else {
  109. console.log("basePath + item.path", basePath + item.path)
  110. const params = encodeURIComponent(JSON.stringify(data.text))
  111. uni.navigateTo({
  112. url: `${basePath}${item.path}?params=${params}`
  113. })
  114. }
  115. })
  116. } else {
  117. navTo(basePath + item.path, item.login);
  118. }
  119. }
  120. const getInfo = (type) => {
  121. //参数说明
  122. let options = {
  123. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  124. data: {
  125. businessType: type
  126. }, //请求参数
  127. method: "POST", //提交方式(默认POST)
  128. showLoading: true, //是否显示加载中(默认显示)
  129. };
  130. return new Promise(async (resolve, reject) => {
  131. const res = await request(infoQuery, options);
  132. const data = stringToJson(res.bizContent);
  133. resolve(data);
  134. }).catch((error) => {
  135. reject(error);
  136. });
  137. }
  138. const previewPdf = (urll) => {
  139. const that = this
  140. let url = urll
  141. uni.showLoading({
  142. title: '加载中'
  143. });
  144. uni.downloadFile({
  145. url,
  146. success: ({
  147. tempFilePath: filePath
  148. }) => {
  149. uni.openDocument({
  150. filePath,
  151. fail: (err) => {
  152. console.log('这是打开报错值:' + err)
  153. },
  154. complete: () => {
  155. uni.hideLoading()
  156. }
  157. })
  158. },
  159. fail: (err) => {
  160. console.log('这是请求报错:', err)
  161. uni.hideLoading()
  162. }
  163. })
  164. }
  165. </script>
  166. <style>
  167. page {
  168. background: #EEF7F7;
  169. padding-bottom: 100rpx;
  170. }
  171. </style>
  172. <style lang="scss" scoped>
  173. .title {
  174. font-size: 26rpx;
  175. font-family: Microsoft YaHei;
  176. font-weight: 400;
  177. color: #666666;
  178. height: 80rpx;
  179. padding-top: 30rpx;
  180. padding-left: 30rpx
  181. }
  182. .action {
  183. margin-top: 30rpx;
  184. font-size: 28rpx;
  185. font-family: Microsoft YaHei;
  186. font-weight: 400;
  187. color: #333333;
  188. line-height: 88rpx;
  189. height: 88rpx;
  190. background: #FFFFFF;
  191. box-shadow: 0rpx 4rpx 11rpx 1rpx rgba(223, 223, 223, 0.5);
  192. }
  193. </style>